Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert Date that Macro runs


Is there anyway that I can have a macro insert a date into a column.
would like to the date and time to show when the macro was run.

Activecell.offset(0,5).value = (actual date and time of when macro wa
run

--
jhahe
-----------------------------------------------------------------------
jhahes's Profile: http://www.excelforum.com/member.php...fo&userid=2359
View this thread: http://www.excelforum.com/showthread.php?threadid=38567

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Insert Date that Macro runs

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz" wrote in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Insert Date that Macro runs

Is there any way to replace part of a date within a macro? I want to change
the month. The syntax is "1/1/2004" I want to have it replaced with
"2/1/2004" but the only thing I need is to update the month in all occurences
of "1/xxx/2004" Right now I am manually editing each line to change a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz" wrote in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Insert Date that Macro runs

The general formula in code
could be something like:

Dim yr as Integer, mnth as Integer, dy as Integer
yr = year(ActiveCell)
mnth = month(ActiveCell)+1
dy = day(ActiveCell)

ActiveCell.Offset(0,5)=DateSerial(yr, mnth, dy)


but if mnth = 13 it must be reset to 1 and yr = yr +1

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Is there any way to replace part of a date within a macro? I want to
change
the month. The syntax is "1/1/2004" I want to have it replaced with
"2/1/2004" but the only thing I need is to update the month in all
occurences
of "1/xxx/2004" Right now I am manually editing each line to change a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz" wrote
in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:

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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Insert Date that Macro runs

Thank you for the code I am going to print it out. It might sound elementary
but would you place this in the macro you are changing or create a new macro
that references the macro to change?

I probably wrote 10 messages here and in MSAccess discussion groups and I
finally figured out how to replace the month with the replace function. The
only thing I have to change is the occurences where it changes not only the
month but the day to. Appreciate the help.

"STEVE BELL" wrote:

The general formula in code
could be something like:

Dim yr as Integer, mnth as Integer, dy as Integer
yr = year(ActiveCell)
mnth = month(ActiveCell)+1
dy = day(ActiveCell)

ActiveCell.Offset(0,5)=DateSerial(yr, mnth, dy)


but if mnth = 13 it must be reset to 1 and yr = yr +1

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Is there any way to replace part of a date within a macro? I want to
change
the month. The syntax is "1/1/2004" I want to have it replaced with
"2/1/2004" but the only thing I need is to update the month in all
occurences
of "1/xxx/2004" Right now I am manually editing each line to change a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz" wrote
in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread:
http://www.excelforum.com/showthread...hreadid=385675









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Insert Date that Macro runs

You're very Welcome!

Put the code where it works best. The choice is always yours...

And you are finding that there are many ways to get there from here...

Making a separate module can simplify your code, make the procedure
available to any other module, and make modifying easier.

Keep on Exceling...

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Thank you for the code I am going to print it out. It might sound
elementary
but would you place this in the macro you are changing or create a new
macro
that references the macro to change?

I probably wrote 10 messages here and in MSAccess discussion groups and I
finally figured out how to replace the month with the replace function.
The
only thing I have to change is the occurences where it changes not only
the
month but the day to. Appreciate the help.

"STEVE BELL" wrote:

The general formula in code
could be something like:

Dim yr as Integer, mnth as Integer, dy as Integer
yr = year(ActiveCell)
mnth = month(ActiveCell)+1
dy = day(ActiveCell)

ActiveCell.Offset(0,5)=DateSerial(yr, mnth, dy)


but if mnth = 13 it must be reset to 1 and yr = yr +1

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Is there any way to replace part of a date within a macro? I want to
change
the month. The syntax is "1/1/2004" I want to have it replaced
with
"2/1/2004" but the only thing I need is to update the month in all
occurences
of "1/xxx/2004" Right now I am manually editing each line to change a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz"
wrote
in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread:
http://www.excelforum.com/showthread...hreadid=385675









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Insert Date that Macro runs

I ran that code. Pretty cool. Now I need to figure out what I can use it for.

"STEVE BELL" wrote:

You're very Welcome!

Put the code where it works best. The choice is always yours...

And you are finding that there are many ways to get there from here...

Making a separate module can simplify your code, make the procedure
available to any other module, and make modifying easier.

Keep on Exceling...

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Thank you for the code I am going to print it out. It might sound
elementary
but would you place this in the macro you are changing or create a new
macro
that references the macro to change?

I probably wrote 10 messages here and in MSAccess discussion groups and I
finally figured out how to replace the month with the replace function.
The
only thing I have to change is the occurences where it changes not only
the
month but the day to. Appreciate the help.

"STEVE BELL" wrote:

The general formula in code
could be something like:

Dim yr as Integer, mnth as Integer, dy as Integer
yr = year(ActiveCell)
mnth = month(ActiveCell)+1
dy = day(ActiveCell)

ActiveCell.Offset(0,5)=DateSerial(yr, mnth, dy)


but if mnth = 13 it must be reset to 1 and yr = yr +1

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Is there any way to replace part of a date within a macro? I want to
change
the month. The syntax is "1/1/2004" I want to have it replaced
with
"2/1/2004" but the only thing I need is to update the month in all
occurences
of "1/xxx/2004" Right now I am manually editing each line to change a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz"
wrote
in
message ...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread:
http://www.excelforum.com/showthread...hreadid=385675










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Insert Date that Macro runs

I just set up a form to scan through a list of dates and change the dates.
(My dates got screwed up)

The form checks each cell for the month #, day #, and year #.
Than I make selections from separate drop-downs for the revised month #, day
#, and year #
and replace the date in the cell using the DateSerial formula.

This allows me to go through a long list and correct all the dates
(especially since all the dates are previous to 2005 - thus preventing me
from just entering m/d)

The code I sent you does something similar. It looks at the date and adds
one month to it. (It also accounts for going from Dec to Jan by changing
the year. Than puts the new date into another cell.

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
I ran that code. Pretty cool. Now I need to figure out what I can use it
for.

"STEVE BELL" wrote:

You're very Welcome!

Put the code where it works best. The choice is always yours...

And you are finding that there are many ways to get there from here...

Making a separate module can simplify your code, make the procedure
available to any other module, and make modifying easier.

Keep on Exceling...

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Thank you for the code I am going to print it out. It might sound
elementary
but would you place this in the macro you are changing or create a new
macro
that references the macro to change?

I probably wrote 10 messages here and in MSAccess discussion groups and
I
finally figured out how to replace the month with the replace function.
The
only thing I have to change is the occurences where it changes not only
the
month but the day to. Appreciate the help.

"STEVE BELL" wrote:

The general formula in code
could be something like:

Dim yr as Integer, mnth as Integer, dy as Integer
yr = year(ActiveCell)
mnth = month(ActiveCell)+1
dy = day(ActiveCell)

ActiveCell.Offset(0,5)=DateSerial(yr, mnth, dy)


but if mnth = 13 it must be reset to 1 and yr = yr +1

--
steveB

Remove "AYN" from email to respond
"lschuh" wrote in message
...
Is there any way to replace part of a date within a macro? I want
to
change
the month. The syntax is "1/1/2004" I want to have it
replaced
with
"2/1/2004" but the only thing I need is to update the month in all
occurences
of "1/xxx/2004" Right now I am manually editing each line to change
a
1/1/2004 to a 2/1/2004.

"Bob Phillips" wrote:

Activecell.offset(0,5).value = Format(Now,"dd mmm yyyy hh:mm:ss")

--
HTH

Bob Phillips

"bhofsetz"
wrote
in
message
...

Use

Activecell.offset(0,5).value = Now

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread:
http://www.excelforum.com/showthread...hreadid=385675












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
Insert date in macro George Gee New Users to Excel 12 April 17th 06 05:44 AM
Insert Date that Macro runs bhofsetz[_108_] Excel Programming 0 July 8th 05 07:24 PM
How do I insert the date using a macro tara0801 Excel Discussion (Misc queries) 4 February 10th 05 09:09 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"