ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Date and time in Cell (https://www.excelbanter.com/excel-programming/410341-insert-date-time-cell.html)

Eric

Insert Date and time in Cell
 
Hello,

I am looking for a line of code that I could add to the end of my macro that
would insert the date and time the macro was first run into a cell named
"vLeadWriteDate". Any help would be great.

JLGWhiz

Insert Date and time in Cell
 
vLeadWriteDate = now

Be sure the column is wide enough or you will see ########.

"Eric" wrote:

Hello,

I am looking for a line of code that I could add to the end of my macro that
would insert the date and time the macro was first run into a cell named
"vLeadWriteDate". Any help would be great.


JLGWhiz

Insert Date and time in Cell
 
If you only want the first occurance, then

If vLeadWriteDate "" The
'Do nothing
Else
vLeadWriteDate = now
End If

"Eric" wrote:

Hello,

I am looking for a line of code that I could add to the end of my macro that
would insert the date and time the macro was first run into a cell named
"vLeadWriteDate". Any help would be great.


JLGWhiz

Insert Date and time in Cell
 
I'll get this right pretty soon. This should do it:

If Range("vLeadWriteDate") "" The
'Do nothing
Else
Range("vLeadWriteDate") = now
End If



"JLGWhiz" wrote:

If you only want the first occurance, then

If vLeadWriteDate "" The
'Do nothing
Else
vLeadWriteDate = now
End If

"Eric" wrote:

Hello,

I am looking for a line of code that I could add to the end of my macro that
would insert the date and time the macro was first run into a cell named
"vLeadWriteDate". Any help would be great.



All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com