Placing time with date

M

Mike K

Oh Wise Ones,
We have a disposition file that records a date the
entry was made among other things. I would like to add the time to that
stamp. I know this is simple for you programmers but I need help with the
syntax.

Current code:

Worksheets("Open Red Tags").Range("J4") = Date

I would like to add the date AND time to J4, but preferably keep the
formatting to display only the date (M/D/YYYY) . Could someone please help?

Thanks,
Mike
 
S

Sam Wilson

Actually you need

with range("J4")
.value = now()
.numberformat="MM/DD/YYYY"
end with
 
M

Mike K

Sam,
Pardon my ignorance but how do I place this to refer to the proper
sheet?
The previous line is:

Worksheets("Red Tag").Range("H20,H46") = Date

which is ok, but then I need to refer to another sheet

Worksheets("Open Red Tags").Range ("J4")= Date

and replace it with this:

Worksheets ("Open Red Tags")
With Range("J4")
.Value = Now()
.NumberFormat = "MM/DD/YYYY"
End With

I get an invalid use of property error.

Mike
 
S

Sam Wilson

Sorry, use this:

With worksheets("Open Red Tags").Range("J4")
.Value = Now()
.NumberFormat = "MM/DD/YYYY"
End With
 
M

Mike K

Beautiful!!

Thanks Sam

Sam Wilson said:
Sorry, use this:

With worksheets("Open Red Tags").Range("J4")
.Value = Now()
.NumberFormat = "MM/DD/YYYY"
End With
 

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

Top