Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Many thanks for all these helpful suggestions.
V |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
"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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Advanced Filtering by Date (or Macro) Help | Excel Worksheet Functions | |||
Todays date | Excel Discussion (Misc queries) | |||
How can I get an age using todays date and date of birth? | Excel Discussion (Misc queries) | |||
How do I sum a range if the date is is greater than today's date? | Excel Worksheet Functions | |||
Date and Time Macro | Excel Discussion (Misc queries) |