A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro to goto specific cell (todays date)



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2010, 03:57 PM posted to microsoft.public.excel.misc
crimekilla
external usenet poster
 
Posts: 2
Default Macro to goto specific cell (todays date)

i have a sheet set up as follows

A B C
1 John Andrew Steve

2 01-01-2010

3 01-02-2010

4 01-03-2010

5 01-04-2010

this sheet goes up to the end of the year 12-31-2010
what i am looking for is a macro that when upon opening the document brings
the user to the row corisponding to the current days date.
  #2  
Old May 11th, 2010, 04:21 PM posted to microsoft.public.excel.misc
Roger Govier[_8_]
external usenet poster
 
Posts: 338
Default Macro to goto specific cell (todays date)

Hi

One way

Sub Auto_Open()
Sheets("Sheet1").Activate
Rows(Date - DateSerial(2010, 1, 1) + 2).Activate
End Sub

--
Regards
Roger Govier

crimekilla wrote:
i have a sheet set up as follows

A B C
1 John Andrew Steve

2 01-01-2010

3 01-02-2010

4 01-03-2010

5 01-04-2010

this sheet goes up to the end of the year 12-31-2010
what i am looking for is a macro that when upon opening the document brings
the user to the row corisponding to the current days date.

  #3  
Old May 11th, 2010, 04:37 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Macro to goto specific cell (todays date)

And if you want that row scrolled up, add the line

ActiveWindow.ScrollRow = ActiveCell.Row

before End Sub


Gord Dibben MS Excel MVP

On Tue, 11 May 2010 16:21:39 +0100, Roger Govier
wrote:

Hi

One way

Sub Auto_Open()
Sheets("Sheet1").Activate
Rows(Date - DateSerial(2010, 1, 1) + 2).Activate
End Sub


  #4  
Old May 11th, 2010, 04:41 PM posted to microsoft.public.excel.misc
JLatham
external usenet poster
 
Posts: 1,896
Default Macro to goto specific cell (todays date)

The code below must go into the Workbook's event code module. To put it
there, open the workbook and press [Alt]+[F11] to open the VB Editor. Press
[Ctrl]+[R] to make sure the "Project - VBAProject" pane is displayed. Expand
the list of objects in VBAProject for your workbook and double-click on the
"ThisWorkbook" entry in the list.
Copy the code below and paste it into that module. Edit the sheet name to
correspond with the correct sheet in your workbook. Close the VB editor.
Save the workbook.
To test it, pick another sheet in the workbook and save/close it. Open it
back up and it should go to the row with today's date in it.

Private Sub Workbook_Open()
'first make sure the correct
'sheet is active and ready to be used
'this sheet must be visible
ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVisible
ThisWorkbook.Worksheets("Sheet1").Activate
ActiveSheet.Range("A1").Activate
ActiveSheet.Cells.Find(What:=Date, After:=ActiveCell, LookIn:=xlFormulas,
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

End Sub


"crimekilla" wrote:

i have a sheet set up as follows

A B C
1 John Andrew Steve

2 01-01-2010

3 01-02-2010

4 01-03-2010

5 01-04-2010

this sheet goes up to the end of the year 12-31-2010
what i am looking for is a macro that when upon opening the document brings
the user to the row corisponding to the current days date.

  #5  
Old May 11th, 2010, 04:42 PM posted to microsoft.public.excel.misc
JLatham
external usenet poster
 
Posts: 1,896
Default Macro to goto specific cell (todays date)

Posting the code again so that you may have a better chance of copying and
pasting it without errors getting injected because of this forum breaking
lines in the wrong places:

Private Sub Workbook_Open()
'first make sure the correct
'sheet is active and ready to be used
'this sheet must be visible
ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVisible
ThisWorkbook.Worksheets("Sheet1").Activate
ActiveSheet.Range("A1").Activate
ActiveSheet.Cells.Find(What:=Date, After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

End Sub


"crimekilla" wrote:

i have a sheet set up as follows

A B C
1 John Andrew Steve

2 01-01-2010

3 01-02-2010

4 01-03-2010

5 01-04-2010

this sheet goes up to the end of the year 12-31-2010
what i am looking for is a macro that when upon opening the document brings
the user to the row corisponding to the current days date.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.