PC Review


Reply
Thread Tools Rate Thread

Add date to cell with open macro

 
 
DDub207 via OfficeKB.com
Guest
Posts: n/a
 
      1st Aug 2007
This should have been easy for me to figure out but I couldn't do it. I'm
just trying to have a cell auto-populate with the current date. I can't use
the =today() function on the sheet because it changes the date on old copies
when they are opened. I would like this to be a workbook_open macro that
works with the one I have below to advance invoice dates. The cell I would
like the date to populate in is M13. Thank, Duane.

Private Sub Workbook_Open()
Range("m3").Value = Range("m3").Value + 1
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1

 
Reply With Quote
 
 
 
 
Paul B
Guest
Posts: n/a
 
      1st Aug 2007
give this a try

Range("m3").Value = Date

Paul B

"DDub207 via OfficeKB.com" <u36243@uwe> wrote in message
news:760baa1848918@uwe...
> This should have been easy for me to figure out but I couldn't do it. I'm
> just trying to have a cell auto-populate with the current date. I can't
> use
> the =today() function on the sheet because it changes the date on old
> copies
> when they are opened. I would like this to be a workbook_open macro that
> works with the one I have below to advance invoice dates. The cell I
> would
> like the date to populate in is M13. Thank, Duane.
>
> Private Sub Workbook_Open()
> Range("m3").Value = Range("m3").Value + 1
> End Sub
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...mming/200708/1
>



 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      1st Aug 2007
Duane,

To put the current date in M3:

Range("m3").Value = Date


--
Hope that helps.

Vergel Adriano


"DDub207 via OfficeKB.com" wrote:

> This should have been easy for me to figure out but I couldn't do it. I'm
> just trying to have a cell auto-populate with the current date. I can't use
> the =today() function on the sheet because it changes the date on old copies
> when they are opened. I would like this to be a workbook_open macro that
> works with the one I have below to advance invoice dates. The cell I would
> like the date to populate in is M13. Thank, Duane.
>
> Private Sub Workbook_Open()
> Range("m3").Value = Range("m3").Value + 1
> End Sub
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...mming/200708/1
>
>

 
Reply With Quote
 
Zone
Guest
Posts: n/a
 
      1st Aug 2007
I presume if m13 already has something in it, it's an "old copy", so you
wouldn't want to put the date in if there's already something in m13. This
just adds the date to m13 if it's empty.
HTH, James

Private Sub Workbook_Open()
Range("m3").Value = Range("m3").Value + 1
If Range("m13") = "" Then Range("m13") = Now
End Sub

"DDub207 via OfficeKB.com" <u36243@uwe> wrote in message
news:760baa1848918@uwe...
> This should have been easy for me to figure out but I couldn't do it. I'm
> just trying to have a cell auto-populate with the current date. I can't
> use
> the =today() function on the sheet because it changes the date on old
> copies
> when they are opened. I would like this to be a workbook_open macro that
> works with the one I have below to advance invoice dates. The cell I
> would
> like the date to populate in is M13. Thank, Duane.
>
> Private Sub Workbook_Open()
> Range("m3").Value = Range("m3").Value + 1
> End Sub
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...mming/200708/1
>



 
Reply With Quote
 
DDub207 via OfficeKB.com
Guest
Posts: n/a
 
      2nd Aug 2007
Thanks... It works.

Paul B wrote:
>give this a try
>
>Range("m3").Value = Date
>
>Paul B
>
>> This should have been easy for me to figure out but I couldn't do it. I'm
>> just trying to have a cell auto-populate with the current date. I can't

>[quoted text clipped - 9 lines]
>> Range("m3").Value = Range("m3").Value + 1
>> End Sub


--
Message posted via http://www.officekb.com

 
Reply With Quote
 
DDub207 via OfficeKB.com
Guest
Posts: n/a
 
      2nd Aug 2007
Thanks... It works.

Vergel Adriano wrote:
>Duane,
>
>To put the current date in M3:
>
>Range("m3").Value = Date
>
>> This should have been easy for me to figure out but I couldn't do it. I'm
>> just trying to have a cell auto-populate with the current date. I can't use

>[quoted text clipped - 6 lines]
>> Range("m3").Value = Range("m3").Value + 1
>> End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1

 
Reply With Quote
 
DDub207 via OfficeKB.com
Guest
Posts: n/a
 
      2nd Aug 2007
Thanks for your help.

Zone wrote:
>I presume if m13 already has something in it, it's an "old copy", so you
>wouldn't want to put the date in if there's already something in m13. This
>just adds the date to m13 if it's empty.
>HTH, James
>
>Private Sub Workbook_Open()
>Range("m3").Value = Range("m3").Value + 1
>If Range("m13") = "" Then Range("m13") = Now
>End Sub
>
>> This should have been easy for me to figure out but I couldn't do it. I'm
>> just trying to have a cell auto-populate with the current date. I can't

>[quoted text clipped - 9 lines]
>> Range("m3").Value = Range("m3").Value + 1
>> End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need macro to add 100 years to a cell's date =?Utf-8?B?YWxpZ2F0cmpvZQ==?= Microsoft Excel Programming 4 19th Sep 2007 04:28 AM
Need the formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Microsoft Excel Misc 0 22nd Jan 2007 12:22 PM
Need Formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Microsoft Excel Misc 0 22nd Jan 2007 12:16 PM
Run a macro with date/cell change =?Utf-8?B?RGFycmVu?= Microsoft Excel Programming 0 10th Feb 2006 10:05 AM
Cell Value & unchanging Date With Macro run Desert Piranha Microsoft Excel Programming 4 23rd Jan 2006 06:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:33 PM.