GOTO Macro Trouble


Posted by Kirk on June 26, 2001 12:23 PM

I'm having trouble setting up a macro and/or devising code to perform a GOTO cell function based upon a chosen item in a list box (Choosing 1 takes you to cell A1, choosing 2 takes you to A50...)

Does anyone know how to perform this and to have the cell appear at the upper left-hand corner of the screen?

Thanks in advance,

Kirk



Posted by Ivan F Moala on June 27, 2001 12:26 AM

Kirk, something like this for your listbox code
may help.

Private Sub ListBox1_Change()
Dim RefAddr As String

Select Case ListBox1.Value

Case 1
RefAddr = "A1"
Case 2
RefAddr = "A20"
Case 3
RefAddr = "B26"
Case 4
RefAddr = "Z26"
Case Else
RefAddr = ActiveCell.Address
End Select

Application.Goto Range(RefAddr), True

End Sub


HTH

Ivan