Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel date lookup using several worksheets
I am writing a macro in workbook_open
what I am wanting to do is search through my workbook for todays date in a certain range. then activate that workbook. I currently have this code Private Sub Workbook_Open() Dim dates As Range Dim cell As Range Dim ws As Worksheet Worksheets(Day(1)).Activate For Each ws In Worksheets On Error Resume Next Worksheets(ws.Name).Activate Set dates = Range("b3") Set cell = dates.Find(Date) If Not cell Is Nothing Then cell.Activate Exit For End If Next ws End Sub But it keeps giveing me the wrong sheet. It selects the last sheet in the workbook. Any help would greatly be appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel date lookup using several worksheets
You're only looking at one cell.
Set dates = Range("b3") maybe: Set dates = Range("b:B") So your loop is not finding anything and it just finishes at with the last sheet. wrote: I am writing a macro in workbook_open what I am wanting to do is search through my workbook for todays date in a certain range. then activate that workbook. I currently have this code Private Sub Workbook_Open() Dim dates As Range Dim cell As Range Dim ws As Worksheet Worksheets(Day(1)).Activate For Each ws In Worksheets On Error Resume Next Worksheets(ws.Name).Activate Set dates = Range("b3") Set cell = dates.Find(Date) If Not cell Is Nothing Then cell.Activate Exit For End If Next ws End Sub But it keeps giveing me the wrong sheet. It selects the last sheet in the workbook. Any help would greatly be appreciated. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel date lookup using several worksheets
I am looking in cell b3 on each sheet looking for the date.
For some reason it will not find the date specified. I also went into the cell and made sure that it was reading the date right and it was. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Function to lookup date on tab in excel and populate date on calen | Excel Worksheet Functions | |||
Lookup date on multiple worksheets, total amts for adjacent colmn | Excel Discussion (Misc queries) | |||
Do Ms Excel able to lookup more than 1 date in spreadsheet? | Excel Worksheet Functions | |||
EXCEL LOOKUP FISCAL YEAR WITH DATE | Excel Worksheet Functions | |||
how to use lookup a value by date for criteria in Excel sheet | Excel Worksheet Functions |