简体   繁体   中英

Executing Vlookup through shortcut keys excel VBA

I am trying to execute Vlookup through keyboard shortcut. I initially tried to use vlookup through the quick access toolbar, but i dont see any specific command button for it. My second method is to have a macro in personal macro workbook to display the function argument dialog box of Vlookup function. I am trying the below code but all it does in open the Insert Function dialog box

ActiveCell.Formula = "=Vlookup(,,,)"
ActiveCell.FunctionWizard

if i try to run the macro on the same cell again it apparently opens the Vlookup Function Argument.Any ideas how can i get keyboard shortcut for Vlookup in one flow

Here is a start.

Assign a shortcut key to the following:

Sub MakeVLOOKUP()
    Dim i1 As String, i2 As String, i3 As String, i4 As String

    i1 = Application.InputBox(prompt:="Enter first argument", Type:=2) & ","
    i2 = Application.InputBox(prompt:="Enter second argument", Type:=2) & ","
    i3 = Application.InputBox(prompt:="Enter third argument", Type:=2)

    ActiveCell.Formula = "=vlookup(" & i1 & i2 & i3 & ")"
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM