On a separate worksheet in A11 enter =TODAY()
In A10 enter =A11 - 1 copy up to A1
In A12 enter =A11 + 1 copy down to A16
Name the range A1:A16 as mydates
On sheet1 select a cell and Data>Validation>List
In Source enter =mydates
Uncheck error alert so's you can enter a date off the list.
It will only default to Today's date if you use sheet event code like
Private Sub Worksheet_Activate()
Me.Range("D1").Value = Date
End Sub
OR..............
Private Sub Workbook_Open()
Sheets("Sheet1").Range("D1").Value = Date
End Sub
Assumes D1 is the DV dropdown cell.
Gord Dibben MS Excel MVP
"HomeTaught" wrote:
Thanks SO MUCH GORD that was so easy to how I have been trying to do it for
the past week ... BUT ... (there is always a but) .. I can't get the code to
work that sets up the default date .. I have copied and pasted and changed
the sells and sheet name to match mine but I think I put it in the wrong
place .. I just opened Developer/visual basic and then pasted in there .. is
that correct?
Thanks
I posted two types of events, neither of which belongs in a standard module.
One is worksheet event code that runs when the sheet is activated.
That code would go into the appropriate sheet module.
Right-click on the sheet tab and "View Code" or if in VBE just double-click
on the sheet module name.
Paste into that sheet module.
The other code is workbook_open code which will set the cell to Today's date
when the workbook is opened.
In VBE, select your workbook/project and expand it.
Double-click on Thisworkbook module.
Paste the workbook_open code into that module.
Nothing wrong with having both sets of code but could be overkill.
I guess it depends upon when you want the date value to default to today's
date.
Gord
Alison
"Gord Dibben" wrote:
> .
>
Put this formula in a cell somewhere out of the way (I used A9),
preferably/possibly on another (hidden?) sheet:
=TODAY()-5
put this formula immediately below it:
=A9+1
you should substitute A9 with the cell address of the first formula.
Copy the second cell down 14 or 15 cells.
Name the whole range "DateRange".
In Data Validation choose List: in the Allow: field then put
=DateRange
in the Source: field.
Under the Error Alert tab, remove the tick from the 'Show error alert
after invalid data is entered'.
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=166902
[url="http://www.thecodecage.com"]Microsoft Office Help[/url]
Thanks again
Private Sub Workbook_Open()
With Sheets("Sheet1").Range("D1")
If .Value = "" Then
.Value = Date
End If
End With
End Sub
Gord
"Gord Dibben" wrote:
> .