LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Macro to insert Now() when cell updates

Hi Bill,
Is what you are trying to do really going to overcome the problem of
each Now being updated or overwritten?. When you use VBA to place Now
in a cell it doesn't put the Now function into that cell it just puts
in the current Now value, ie a static date and time value. Each time
your code runs it will update the cell with the new Now value and you
lose the old one. If you don't want to lose any old Now values you will
need to use the Offset method to shift all the older Now values across
one column or down one row.
For example: when the following code is run it puts the current Now
value into B1 then shifts all previous Now values down one row by way
of the Offset method copying each value into the cell immediately
below. When the loop reaches B1 that too is copied into B2.

Public Sub SaveOldNows()
Range("B1").Value = Now
For iRowOffset = Application.Count(Range("B:B")) To 1 Step -1
'Shift old time values down 1 row
Let Cells(iRowOffset + 1, 2).Value = Cells(iRowOffset, 2).Value
Next iRowOffset
End Sub

Also, what is the effect of the "\"'s in your code. I've never seen
anything like it before?
<if range(\"f6:f45\") = \"1\" then

Also, in the first line of your code are you intending to detect if the
sheet change has occurred anywhere in the range F6:F45?
If that is the case then the way I have seen it done is...

If Intersect(Target,Range("F6:F45")) Is Nothing then
Exit Sub
End If

Hope this helps you.

Ken Johnson

 
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
if/then insert date but don't want automatic updates redleg Excel Discussion (Misc queries) 7 September 29th 09 09:59 PM
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
Macro to Insert Comment to a cell wojo Excel Programming 0 July 21st 05 04:06 PM
Macro updates Glen Mettler[_4_] Excel Programming 3 June 29th 05 01:02 AM
Macro updates and link goes #REF! ??? Rob Smith Links and Linking in Excel 1 February 16th 05 01:03 PM


All times are GMT +1. The time now is 03:25 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"