![]() |
on open goto cell with today's date
Private Sub Workbook_Open()
Dim res As Variant Dim Rng As Range Worksheets(2).Activate Set Rng = Worksheets(2).Range("B2:H2") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select Else Set Rng = Worksheets(2).Range("B22:H22") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select End If End If End Sub -- Regards, Tom Ogilvy DL wrote in message ... The range B2:H2,B22:H22 contains dates. Could this macro be amended to go to include the range B22:H22? Private Sub Workbook_Open() Dim res As Variant Dim Rng As Range Worksheets(2).Activate Set Rng = Worksheets(2).Range("B2:H2") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select End If End Sub |
on open goto cell with today's date
Many, many thanks for your assistance. It is much appreciated.
"Tom Ogilvy" wrote in message ... Private Sub Workbook_Open() Dim res As Variant Dim Rng As Range Worksheets(2).Activate Set Rng = Worksheets(2).Range("B2:H2") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select Else Set Rng = Worksheets(2).Range("B22:H22") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select End If End If End Sub -- Regards, Tom Ogilvy DL wrote in message ... The range B2:H2,B22:H22 contains dates. Could this macro be amended to go to include the range B22:H22? Private Sub Workbook_Open() Dim res As Variant Dim Rng As Range Worksheets(2).Activate Set Rng = Worksheets(2).Range("B2:H2") res = Application.Match(CLng(Date), Rng, 0) If Not IsError(res) Then Rng(res).Select End If End Sub |
All times are GMT +1. The time now is 04:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com