I have a macro that I wrote several years ago that works but I don't know how! Ok, yes, I am a very part-time vba coder. This script runs by entering a 5 digit number in a cell (C3) in my spreadsheet. I did not use a InputBox. It then returns an alphanumeric code associated with it. The result is in cell (D3). I am using the VLOOKUP function. The cursor ends up in the cell below the user entry cell and I want it to be returned to the original, user entry cell (C3). As I said the code functions. If I step through the code with the Debugger, I get errors. Here is my code.
Sub FindPSWD()
' This sub finds the password associated with the code entered by the user
Dim PSWD_Code As String
Dim PSWD As String
' Identify the cell that the Password Code is to be entered
PSWD_Code = "c3"
PSWD = Application.WorksheetFunction.VLookup(PSWD_Code, Sheet1.Range("F2:G10000"), 2, False)
' Move the cursor back to C3
ActiveCell.Offset(-1, 0).Select
Range("c3").Select
End Sub