Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #2   Report Post  
Posted to microsoft.public.excel.programming
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







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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
Goto Cell With Today's Or Other Date jonoro Excel Worksheet Functions 2 December 22nd 09 02:43 AM
date in Cell to change colors if the date is beyond today's date Pete Elbert Excel Discussion (Misc queries) 2 June 6th 09 06:31 AM
How to use Today's date in a cell and make it stay the same date ADSK Excel Discussion (Misc queries) 6 November 17th 08 07:34 PM
How to automatically goto to today's date Hans gmail Excel Worksheet Functions 4 January 26th 07 05:41 AM


All times are GMT +1. The time now is 04:09 AM.

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

About Us

"It's about Microsoft Excel"