I currently use Excel 2002 at work and I have a bit of a conundrum. I wondered if it was possible to make the cursor appear on the cell that contains the current date whatever that may be. Someone at work was kind enough to provide the following, but my VBA knowledge is very limited. (I did try contacting the person but after three days have not heard anything). I have tried putting the code into the VBA Module and also on to the VBA Sheet, but nothing appears to work.
Private Sub Workbook_Open()
Application.Goto Reference:="R2C1"
'get todays date
dte = Date
'select the sheet that contains the dates
Sheets("sheet1").Select
'select the first cell that contains a date
Range("A2").Select
'check if the cell is before todays date
While ActiveCell.Value < dte
'scroll down the page (for across use offset(0,1)
ActiveCell.Offset(0, 1).Select
'there are no more dates to check so stop
If ActiveCell.Row > 500 Then Exit Sub
Wend
'we went one too far so go back up one
'ActiveCell.Offset(-1, 0).Select
End Sub
I have two spreadsheets one with the dates running across from A2 to Z2, the other the dates are running down column B from B2 to B500. TIA
Bookmarks