Getting spreadsheet to start on today's date

  • Thread starter Thread starter Rhema
  • Start date Start date
R

Rhema

I have created a roster using excel. The columns consist of a series o
sequential dates. When the user fires up the roster, I want the roste
to automatically display today's date in the first column.
ie. The first column is F2.

Can anyone suggest a short script to achieve this.

Thanks in advance

Regards

Rhem
 
Hi Rhema,

In F2 type =today()

Note, however, that this will update everytime that you open the file. In
G2 you could then type = F2+1 to give you the next day (eg 18/11/03) and so
on and so forth.

HTH,
Katherine
 
you can set the cell value to...=TODAY()
the next cell to ... =TODAY()+1
and the next cell... =TODAY()+2 Etc.
 
To make something happen when a file opens, you need code.

Rightclick the Excel icon left of "File" in the menu bar (File, Edit, View,
etc.), select "View Code". This will display the workbook code module.

Here's an example of some workbook_open code (AKA a macro/procedure, IAF
it's an "event procedure", something that happens at a specific
time/occurrence, in this case the opening of the file) ;

Private Sub WorkBook_Open()
MsgBox "Hi."
End Sub

Copy it into your module. All you need to do is replace the line(s) between
1st & last (MsgBox "Hi.") with whatever you want to happen.

As a test, I entered "Name" in A1 and some names underneath. In B1:AE1 I
entered 1-Nov-03, 2-Nov-03, ... 30-Nov-03.

In the workbook_open code I used this -

Sheets("Sheet1").Select
Range("B1").Select
Do Until ActiveCell.Value = Date
Selection.EntireColumn.Hidden = True
ActiveCell.Range("B1").Select
Loop

NB - this relies on today's date already existing somewhere in B1:AE1, if
there are some circumstances where it might not (eg: someone changing the PC
date to 1-Jan-2010) you'll need to think it through & maybe post back for
help on how to tweak it.

Rgds,
Andy
 

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