Default today's date - Excel 2000

  • Thread starter Thread starter Abay
  • Start date Start date
A

Abay

How can I default to-day's date in one cell and the current time in another
for each row. I know I can press Cntrl + ; etc. but want the date to be
entered automatically.

Any help would be much appreciated.

Abay
 
=TODAY()

=NOW()

latter formatted as time or you'll get a date as well

--
Regards,

Peo Sjoblom

(No private emails please)
 
Thank you .. but is there a way to have them default, so that when you tab
from cell to cell the date and time are entered are entered automatically.
I have created a form for data entry and would like the date and time (both
are fields in the form) entered automatically as the user tabs from one
field to the other.

Am a newbie more or less at Excel .. know I can do this in Access, & am
hoping it can work in Excel also.

Again many thanks for your help.

Abay
 
You can do this with VBA, this assumes you want it in columns G and H when
you select G

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "G1:G1000"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = Format(Date, "dd mmm yyyy")
.Offset(0, 1).Value = Format(Now, "hh:mm:ss")
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--


HTH

RP
(remove nothere from the email address if mailing direct)
 
That worked great when entering data directly into the spread sheet, no luck
when entering data in the form .. <sigh> ..

Many thanks again for your help.

Abay
 

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