Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to activate cell for editing with single clicking in Excel?

This article is talking about activating cell for editing with single click in Excel. Please do as follows step by step.

Activate cell for editing with single clicking by VBA code


Activate cell for editing with single clicking by VBA code


The following VBA code can help you to activate cell for editing with single clicking.

1. Open the worksheet you need to activate cell with single clicking. Right click the Sheet Tab and click View Code from the right-clicking menu.

2. In the opening Microsoft Visual Basic for Applications window, copy and paste the below VBA code into the Code window.

VBA code: Activate cell for editing with single clicking

#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. Press the Alt + Q keys simultaneously to close the Microsoft Visual Basic for Applications window.

From now on, when single click on any cell in current worksheet, the cell will be activated immediately.



Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ryan · 7 months ago
    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.
  • To post as a guest, your comment is unpublished.
    Wayne · 1 years ago
    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!
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Dear Wayne,
      The code is now updated with the problem fixed. Thank you for your feedback.
  • To post as a guest, your comment is unpublished.
    Wayne · 1 years ago
    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!
  • To post as a guest, your comment is unpublished.
    Damjan · 1 years ago
    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.
    • To post as a guest, your comment is unpublished.
      crystal · 1 years ago
      Good Day,
      The code is updated with the problem solving. Thank you for your comment.