ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   InputBox - search for value and jump to cell (https://www.excelbanter.com/excel-programming/340109-inputbox-search-value-jump-cell.html)

Inge[_2_]

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



All times are GMT +1. The time now is 01:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com