VBA code to select a cell so it appears in the top left of the screen
Hi Kenny
If Not IsError(res) Then
Range("A1:A365")(res).Activate
ActiveWindow.ScrollRow = res
Else
--
Regards
Roger Govier
"Forum Freak" wrote in message
...
Hi
I would like to modify the following code (supplied by Tom Ogilvy I think)
Column A contains dates and blank cells, code asks for date then selects
it.
It would look really neat if the selected cell appeared in the top left of
the screen.
Can it be done?
TIA
Kenny W
Using XP Pro and Office 2003
Code below here
---------------------
Sheets("units").Select
ans = InputBox("Please enter W/E required as date (dd/mm/yy)")
If IsDate(ans) Then
dt = CDate(ans)
res = Application.Match(CLng(dt), Range("A1:A365"), 0)
If Not IsError(res) Then
Range("A1:A365")(res).Activate
Else
MsgBox ans & " was not matched"
End If
Else
If Len(Trim(ans)) = 0 Then
MsgBox "You hit cancel"
Else
MsgBox ans & " Not recognized as a date"
End If
End If
Sheets("units").Select
ActiveCell.Range("A1").Select
|