Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to activate cell for editing with single clicking in Excel?
When we need to make changes to anything in any cell, editing is a typical practice. Therefore, it is really necessary to get some practice using the shortcut key for this particular activity. There are times when we have to change the content of the cell. Because we frequently need to amend the formula or debug the formula, the shortcut is quite useful. Often, we may need to edit the formula. In addition, it is essential to practice shortcut keys in order to reduce the amount of time required for particular tasks when you are a new learner. Because of this, it would be really convenient if we could edit a cell with only one click on the cell itself.
This article discusses how to make cells editable in Excel with just one click by activating certain cells using VBA.
Activate Cell with Single Click Using VBA Code
Step 1
Open the excel sheet in which you want to apply this code. Select the sheet and Click the View Code option that appears in the context menu after you right-click the Sheet Tab. See the below given image.

Step 2
The following Visual Basic for Applications code should be written into the Code window of the new window that opens up for Microsoft Visual Basic for Applications.
#If Win64 Then
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
See the below given image.

Step 3
To close the window displaying Microsoft Visual Basic for Applications, concurrently press the Alt+Q buttons on your keyboard. When you go forward, any time you make a single click on a cell in the current worksheet, that cell will become active immediately. See the image given below.

Conclusion
In the above tutorial, you learnt about a VBA code to activate the cell with a single click.