Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox list appears on far left side of screen Greg Lovern Excel Programming 1 March 7th 08 08:19 PM
Code to Auto Select OK when an Option Box Appears [email protected] Excel Discussion (Misc queries) 7 February 21st 08 02:19 AM
Positioning a cell at the top left of the screen Ben Excel Programming 4 May 14th 05 01:22 PM
Move Cell to Top/Left Position on Screen Phil Hageman[_3_] Excel Programming 4 January 10th 04 07:24 PM
Moving the Active cell to the left of the screen Dave Bash Excel Programming 1 December 17th 03 04:11 PM


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"