View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Inge[_2_] Inge[_2_] is offline
external usenet poster
 
Posts: 1
Default InputBox - search for value and jump to cell


I have this code for looking up the week (in numbers). The code is
working fine with the exception that I would like to scroll through the
window so that the chosen week appears on the screen. Can anyone help me
out?

Private Sub Worksheet_Activate()
Dim c As Range
Dim firstAddress As String
Dim myAns As Integer

myAns = Application.InputBox("Enter a week number", , 1, , , , , 1)

With Worksheets(1).Range("a1:a500")
Set c = .Find(myAns, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Select
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub


--
Inge
------------------------------------------------------------------------
Inge's Profile: http://www.excelforum.com/member.php...o&userid=27257
View this thread: http://www.excelforum.com/showthread...hreadid=467692