Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Macro to jump to today's date

Hi

I have an Excel spreadsheet which includes, in Col A, a list of all 365 days
of the year.

When opening the spreadsheet, using an auto_open macro, I would like the
opening view to include today's date (perhaps a few rows down from the top).

Can anyone please recommend which functions I need to use in the macro to
make the spreadsheet open in this way.

Many thanks,

V


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Macro to jump to today's date


You could try

Columns(1).find(Date,,xlvalues,xlwhole).select

I've tried this sort of thing before and you can get problems because
of date formats.


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=557685

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Macro to jump to today's date

You can try to run this Victor


Sub Find_Todays_Date()
Dim FindString As Date
Dim rng As Range
FindString = Date
With Sheets("Sheet1").Range("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.Goto rng, True
Else
MsgBox "Nothing found"
End If
End With
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl



"Victor Delta" wrote in message ...
Hi

I have an Excel spreadsheet which includes, in Col A, a list of all 365 days of the year.

When opening the spreadsheet, using an auto_open macro, I would like the opening view to include today's date (perhaps a few rows
down from the top).

Can anyone please recommend which functions I need to use in the macro to make the spreadsheet open in this way.

Many thanks,

V



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Macro to jump to today's date

Try:

With Range("A:A")
Set c = .Find(DateValue(Now()), LookIn:=xlValues)
If Not c Is Nothing Then
ActiveWindow.ScrollRow = c.Row - 3
End If
End With

this will position the dates 3 rows fom today.

HTH

"Victor Delta" wrote:

Hi

I have an Excel spreadsheet which includes, in Col A, a list of all 365 days
of the year.

When opening the spreadsheet, using an auto_open macro, I would like the
opening view to include today's date (perhaps a few rows down from the top).

Can anyone please recommend which functions I need to use in the macro to
make the spreadsheet open in this way.

Many thanks,

V



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 718
Default Macro to jump to today's date

Sub Macro1()
Dim lRow As Long
lRow = Date - DateSerial(Year(Date), 1, 1) + 1
ActiveWindow.ScrollRow = lRow + 1
Cells(lRow, "A").Activate
End Sub

HTH
--
AP

"Victor Delta" a écrit dans le message de news:
...
Hi

I have an Excel spreadsheet which includes, in Col A, a list of all 365
days of the year.

When opening the spreadsheet, using an auto_open macro, I would like the
opening view to include today's date (perhaps a few rows down from the
top).

Can anyone please recommend which functions I need to use in the macro to
make the spreadsheet open in this way.

Many thanks,

V





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 195
Default Macro to jump to today's date

Why not just put this in the ThisWorkbook module?:
Private Sub Workbook_Open()
ActiveSheet.Columns(1).Find(Date).Select
End Sub

--
David

Victor Delta wrote

Hi

I have an Excel spreadsheet which includes, in Col A, a list of all
365 days of the year.

When opening the spreadsheet, using an auto_open macro, I would like
the opening view to include today's date (perhaps a few rows down from
the top).

Can anyone please recommend which functions I need to use in the macro
to make the spreadsheet open in this way.

Many thanks,

V



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Macro to jump to today's date

Many thanks for all these helpful suggestions.

V


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Macro to jump to today's date

"Ron de Bruin" wrote in message
...
You can try to run this Victor
Sub Find_Todays_Date()
Dim FindString As Date
Dim rng As Range
FindString = Date
With Sheets("Sheet1").Range("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.Goto rng, True
Else
MsgBox "Nothing found"
End If
End With
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl


Ron

Many thanks - it works.

However, what do I need to add to this to scroll up about 3 lines - i.e. so
today's date is not right at the top? I've tried several VBA commands but
they don't seem to work for me!

Thanks,

V


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Macro to jump to today's date

Try this

Application.Goto rng.Offset(-3, 0), True


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Victor Delta" wrote in message ...
"Ron de Bruin" wrote in message ...
You can try to run this Victor
Sub Find_Todays_Date()
Dim FindString As Date
Dim rng As Range
FindString = Date
With Sheets("Sheet1").Range("A:A")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Application.Goto rng, True
Else
MsgBox "Nothing found"
End If
End With
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl


Ron

Many thanks - it works.

However, what do I need to add to this to scroll up about 3 lines - i.e. so today's date is not right at the top? I've tried
several VBA commands but they don't seem to work for me!

Thanks,

V



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Macro to jump to today's date

"Ron de Bruin" wrote in message
...
Try this

Application.Goto rng.Offset(-3, 0), True


--
Regards Ron de Bruin
http://www.rondebruin.nl


Brilliant. Many thanks.

V


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
Advanced Filtering by Date (or Macro) Help Alexis Excel Worksheet Functions 1 March 8th 06 05:09 PM
Todays date rexmann Excel Discussion (Misc queries) 5 January 12th 06 03:18 PM
How can I get an age using todays date and date of birth? tjw1313 Excel Discussion (Misc queries) 3 December 3rd 05 01:23 AM
How do I sum a range if the date is is greater than today's date? S2 Excel Worksheet Functions 4 October 8th 05 08:11 PM
Date and Time Macro m.j.anderson Excel Discussion (Misc queries) 1 December 1st 04 12:35 AM


All times are GMT +1. The time now is 12:59 PM.

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"