PPRuNe Forums - View Single Post - Another Excel Question
View Single Post
Old 30th January 2008 | 13:31
  #16 (permalink)  
vindaloo
 
Joined: Sep 2002
Posts: 34
Likes: 0
From: UK
If you used my method of VB code in the WorkbookOpen() section, you might want to try the following amendment:

Put the cursor into the cell containing the Column Header of your dates, and then overtype the cell name (eg. A1) with "start_date".

Now amend the code:

Private Sub Workbook_Open()

For Each cell In Range("start_date", Range("start_date").End(xlDown)).Cells

If cell.Value = Date Then
cell.Offset(0, 1).Select
Exit For
End If

Next cell

End Sub


This will do 2 things:

1) The whole date column will be searched for today's date, even as it expands (the first example I gave you had a fixed range of A1:A10), and you won't ever have to change the VB code.

2) The line containing cell.Offset means that the cursor will be positioned on the cell to the right of today's date, as presumably you won't want to be changing the date field. The numbers can be adjusted to position the cursor elsewhere.

Regards,
Vindaloo (bored at work)
vindaloo is offline  
Reply