View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DL[_3_] DL[_3_] is offline
external usenet poster
 
Posts: 13
Default 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