find a date using several worksheets

  • Thread starter Thread starter bpotter
  • Start date Start date
B

bpotter

I have a workbook that has several worksheets. On each worksheet I have
a column that that has a date of the month. I am trying to write a
macro code that will open the workbook using todays date. I have tried
several codes and each time it opens to the last worksheet in the
workbook. PLease help. I have been working on this for several days now
and cannot seem to get it right.
 
Try this:

WorkBook_Open()

Dim objSheet as WorkSheet

For Each objSheet In ActiveWorkBook.WorkSheets
'assuming the date is in the same position on all sheets
If objSheet.Cells(1,1).Value = strSearch then
objSheet.Activate
End If
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top