MrExcel Publishing
Your One Stop for Excel Tips & Solutions

GOTO Macro Function


Posted by David Martin on June 21, 2001 1:00 PM

Hi!

I am trying to write a macro that will move the cursor to an area of the spreadsheet based on a value a user puts in. For example, if user inputs "1", the macro will "jump" the cursor to cell A50, if user inputs "2" it "jumps" to another cell address.

Does anyone know how to do this?


Posted by mseyf on June 21, 2001 2:10 PM

you can use something like:

Sub Test()
Dim intInput As Integer

intInput = CInt(Application.InputBox(prompt:="enter a 1 or 2", Type:=1))
Select Case intInput
Case 1
Range("a50").Select
Case 2
Range("a60").Select
End Select

End Sub