メインコンテンツへスキップ

Excelでシングルクリックして編集するためにセルをアクティブ化するにはどうすればよいですか?

この記事では、Excelでシングルクリックして編集するためにセルをアクティブ化する方法について説明しています。 ステップバイステップで次のようにしてください。

VBAコードでシングルクリックして編集するセルをアクティブ化する


VBAコードによるシングルクリックで編集用のセルをアクティブ化

次のVBAコードは、シングルクリックで編集するためにセルをアクティブ化するのに役立ちます。

1.シングルクリックでセルをアクティブ化するために必要なワークシートを開きます。 [シート]タブを右クリックして、 コードを表示 右クリックメニューから。

2.オープニングで アプリケーション向け Microsoft Visual Basic ウィンドウで、以下のVBAコードをコピーして Code 窓。

VBAコード:シングルクリックで編集するためにセルをアクティブ化する

#If Win64 Then
'Updated by Extendoffice 2018/2/2
    Private Declare PtrSafe Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Private Declare PtrSafe Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
#Else
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
#End If
Const VK_NUMLOCK = 144
Const VK_CAPITAL = 20
Const VK_SCROLL = 145
Dim xOldNLState As Long
Dim xOldCLState As Long
Dim xOldSLState As Long
Const KEY_MASK As Integer = &HFF80 '

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If (GetKeyState(vbKeyShift) And KEY_MASK) <> 0 Then Exit Sub
    xOldNLState = GetAsyncKeyState(VK_NUMLOCK)
    xOldCLState = GetAsyncKeyState(VK_CAPITAL)
    xOldSLState = GetAsyncKeyState(VK_SCROLL)
    SendKeys "{F2}"
    If GetAsyncKeyState(VK_NUMLOCK) <> xOldNLState Then
        Application.SendKeys "{NUMLOCK}"
    End If
    If GetAsyncKeyState(VK_CAPITAL) <> xOldCLState Then
        Application.SendKeys "{CAPSLOCK}"
    End If
    If GetAsyncKeyState(VK_SCROLL) <> xOldSLState Then
        Application.SendKeys "{SCROLLLOCK}"
    End If
End Sub

3。 プレス 他の + Q キーを同時に閉じて アプリケーション向け Microsoft Visual Basic 窓。

これ以降、現在のワークシートのいずれかのセルをシングルクリックすると、そのセルがすぐにアクティブになります。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
nice and understood
This comment was minimized by the moderator on the site
Is there a way to make it so that you can be in one program window an click into the window for excel and onto the cell in one click? I noticed, while it does go right to edit mode, it goes to the previous cell when you click into the program so that it still requires two clicks to start editing.
This comment was minimized by the moderator on the site
Sorry, not sure if my last post was published. Here it is again just in case:

Hey Everyone, first off, many thanks for posting this, it's a definite time saver. Just noticed that if you try to use the "Shift+tab" keyboard command to move one cell to the left, a comment box gets created instead. Anyway to fix this issue? Thanks!
This comment was minimized by the moderator on the site
Dear Wayne,
The code is now updated with the problem fixed. Thank you for your feedback.
This comment was minimized by the moderator on the site
Hey Everyone, first off, many thanks for posting this, it's a definite time saver. Just noticed that if you try to use the "Shift+tab" to move one cell to the left, a comment box gets created instead. Anyway to fix this issue? Thanks!
This comment was minimized by the moderator on the site
Hey guys. I had a question about a strange side effect this code does when I use it in one of my worksheets.
The code I tried was the one mentioned in the post.
//
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
SendKeys "{F2}"
End Sub
//
The side effect I'm getting is when I make a cell active my Numlock turns off/on.
Any help would be appreciated.
This comment was minimized by the moderator on the site
Good Day,
The code is updated with the problem solving. Thank you for your comment.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations