Opening worksheet to start in a specific cell

  • Thread starter Thread starter Ron S
  • Start date Start date
R

Ron S

I have created a workbook with a worksheet for each month
of the year. In each worksheet I have created a table
representing that month with the days of the month
accross the top. When I open the worksheet I would like
it to open with the cell for today's date highlighted.
Anyone knoe how to write a formula for this? Thanks

Ron
 
one way:

Put this in the ThisWorkbook code module (right-click on the
workbook title bar, choose View Code, paste the following in the
window that opens, then click the XL icon on the toolbar to return
to XL):

Private Sub Workbook_Open()
Application.Goto Sheets(Month(Date)).Cells(1, Day(Date))
End Sub
 
Assuming your month number is in A1 and that your day
numbers are in the cells A2 to G7, this would work.

You need to place this in your activate event of your
excel sheet.

If Range("A1") <> Month(Date) Then Exit Sub
For Each x In Range("A2", "G7")
If x.Value = Day(Date) Then
x.Select
Exit For
End If
Next x
 
if it's just the cell you're worried about and not the
sheet, you could just doa conditional format to the date
cells ie:
in cell A1: Oct 17, 2003
the condit format would simply be:
=if(a1=today(),true,false)
written like this, the calendar would highlight the cell
that is equal to today's date. because i'm not too
familiar with VB, i'm forced to figure the goofy things
out in excel. i've never tried this, but the formula is
sound.
HTH
Kevin McClement
 
Back
Top