ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code to add date (https://www.excelbanter.com/excel-programming/313825-vba-code-add-date.html)

npereira[_6_]

VBA Code to add date
 

Excellent !

That worked like a charm. Thansk again!

I have another question, but this has no revelance to this topic so
will start a new topic

--
npereir
-----------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...fo&userid=1079
View this thread: http://www.excelforum.com/showthread.php?threadid=26998


Mike Fogleman

VBA Code to add date
 
One note of caution using that on a template. Every time you open an invoice
made from that template the date will update to today's date and overwrite
the actual date the Invoice was created. I found this out the hard way
myself.
Mike F
"npereira" wrote in message
...

Excellent !

That worked like a charm. Thansk again!

I have another question, but this has no revelance to this topic so I
will start a new topic.


--
npereira
------------------------------------------------------------------------
npereira's Profile:

http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=269988




Dave Peterson[_3_]

VBA Code to add date
 
Good point.

If that's a concern to the OP:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Me.Worksheets("sheet1").Range("e11")
if .value = "" then
.Value = Date
.NumberFormat = "mmmm dd, yyyy"
end if
End With
End Sub

Checks what's in that cell first.

Mike Fogleman wrote:

One note of caution using that on a template. Every time you open an invoice
made from that template the date will update to today's date and overwrite
the actual date the Invoice was created. I found this out the hard way
myself.
Mike F
"npereira" wrote in message
...

Excellent !

That worked like a charm. Thansk again!

I have another question, but this has no revelance to this topic so I
will start a new topic.


--
npereira
------------------------------------------------------------------------
npereira's Profile:

http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=269988


--

Dave Peterson



All times are GMT +1. The time now is 05:21 AM.

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