![]() |
VBA code to select a cell so it appears in the top left of the screen
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 |
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 |
VBA code to select a cell so it appears in the top left of the screen
Another one -
If Not IsError(res) Then Application.Goto Range("A1:A365")(res), True Else Regards, Peter T "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 |
VBA code to select a cell so it appears in the top left of the screen
Many thanks this was exactly what I needed. Works a treat!
Kenny "Peter T" <peter_t@discussions wrote in message ... Another one - If Not IsError(res) Then Application.Goto Range("A1:A365")(res), True Else Regards, Peter T "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 |
All times are GMT +1. The time now is 12:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com