Ga naar hoofdinhoud

Hoe cellen te activeren voor bewerking met één klik in Excel?

Dit artikel gaat over het activeren van cellen voor bewerking met een enkele klik in Excel. Ga als volgt te werk, stap voor stap.

Activeer cellen voor bewerking met een enkele klik met VBA-code


Activeer cel voor bewerking met een enkele klik door VBA-code

De volgende VBA-code kan u helpen om cellen te activeren voor bewerking met een enkele klik.

1. Open het werkblad dat u nodig hebt om cellen te activeren met een enkele klik. Klik met de rechtermuisknop op de bladtab en klik op Bekijk code vanuit het rechtsklikmenu.

2. In de opening Microsoft Visual Basic voor toepassingen -venster, kopieer en plak de onderstaande VBA-code in het Code venster.

VBA-code: activeer cel voor bewerking met één klik

#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. druk de anders + Q toetsen tegelijk om het Microsoft Visual Basic voor toepassingen venster.

Als u vanaf nu eenmaal op een cel in het huidige werkblad klikt, wordt de cel onmiddellijk geactiveerd.

Beste Office-productiviteitstools

🤖 Kutools AI-assistent: Een revolutie teweegbrengen in de data-analyse op basis van: Intelligente uitvoering   |  Genereer code  |  Aangepaste formules maken  |  Analyseer gegevens en genereer grafieken  |  Roep Kutools-functies aan...
Populaire functies: Zoek, markeer of identificeer duplicaten   |  Verwijder lege rijen   |  Combineer kolommen of cellen zonder gegevens te verliezen   |   Ronde zonder formule ...
Super opzoeken: Meerdere criteria VLookup    VLookup met meerdere waarden  |   VOpzoeken over meerdere bladen   |   Fuzzy opzoeken ....
Geavanceerde vervolgkeuzelijst: Maak snel een vervolgkeuzelijst   |  Afhankelijke vervolgkeuzelijst   |  Multi-select vervolgkeuzelijst ....
Kolom Beheerder: Voeg een specifiek aantal kolommen toe  |  Kolommen verplaatsen  |  Schakel de zichtbaarheidsstatus van verborgen kolommen in  |  Vergelijk bereiken en kolommen ...
Uitgelichte functies: Raster focus   |  Ontwerpweergave   |   Grote formulebalk    Werkmap- en bladbeheer   |  resource Library (Auto-tekst)   |  Datumkiezer   |  Combineer werkbladen   |  Cellen coderen/decoderen    Stuur e-mails per lijst   |  Super filter   |   Speciaal filter (filter vet/cursief/doorhalen...) ...
Top 15 gereedschapsets12 Tekst Tools (toe te voegen tekst, Tekens verwijderen, ...)   |   50+ tabel Types (Gantt Chart, ...)   |   40+ Praktisch Formules (Bereken leeftijd op basis van verjaardag, ...)   |   19 Invoeging Tools (QR-code invoegen, Afbeelding invoegen vanaf pad, ...)   |   12 Camper ombouw Tools (Getallen naar woorden, Currency Conversion, ...)   |   7 Samenvoegen en splitsen Tools (Geavanceerd Combineer rijen, Gespleten cellen, ...)   |   ... en meer

Geef uw Excel-vaardigheden een boost met Kutools voor Excel en ervaar efficiëntie als nooit tevoren. Kutools voor Excel biedt meer dan 300 geavanceerde functies om de productiviteit te verhogen en tijd te besparen.  Klik hier om de functie te krijgen die u het meest nodig heeft...

Omschrijving


Office-tabblad Brengt een interface met tabbladen naar Office en maakt uw werk veel gemakkelijker

  • Schakel bewerken en lezen met tabbladen in Word, Excel, PowerPoint in, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en vermindert honderden muisklikken voor u elke dag!
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