[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Tracking Changes to Cells?

jpuopolo

12/19/2006 4:53:00 PM

All:

I have a simple spreadsheet where a user can enter values into columns
A, B or C. In column D, I would like to place the current date and time
(NOW()) if the data in A, B or C changes in any way. Is there a formula
I can use to do this, or do I need to resort to developing an
add-in/code.

Thanks,
jpuopolo

2 Answers

John Coleman

12/19/2006 5:50:00 PM

0

Hi,

There might be some way to do something along the lines of what you
want via the tracking changes tools built into Excel. I'm not too
familar with those tools. Here is a simple VBA approach to what I think
you want:

Private Sub Worksheet_Change(ByVal Target As Range)
If Union(Range("A:C"), Target).Address = "$A:$C" Then
Range("D1").Value = Now
End If
End Sub

Just paste this into the code module for the corresponding sheet, and
format D1 (or whatever cell you want to put the now value into) as the
desired date format, then any time a user enters or deletes a value in
columns A,B,C; D1 will be updated to reflect the time this change
occurs. Note that if A,B, or C contains formulas depending on data
outside of those columns, a change in such external data will trigger a
change in the *computed* value in columns A,B,C without firing this
macro. For that - you would also have to monitor the correpsonding
external inut cells for change.

Hope that helps

-John Coleman
john wrote:
> All:
>
> I have a simple spreadsheet where a user can enter values into columns
> A, B or C. In column D, I would like to place the current date and time
> (NOW()) if the data in A, B or C changes in any way. Is there a formula
> I can use to do this, or do I need to resort to developing an
> add-in/code.
>
> Thanks,
> jpuopolo

jpuopolo

12/19/2006 7:10:00 PM

0

John:

Thank you very much! This is exactly what I was looking for.

Best,
jpuopolo

John Coleman wrote:
> Hi,
>
> There might be some way to do something along the lines of what you
> want via the tracking changes tools built into Excel. I'm not too
> familar with those tools. Here is a simple VBA approach to what I think
> you want:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Union(Range("A:C"), Target).Address = "$A:$C" Then
> Range("D1").Value = Now
> End If
> End Sub
>
> Just paste this into the code module for the corresponding sheet, and
> format D1 (or whatever cell you want to put the now value into) as the
> desired date format, then any time a user enters or deletes a value in
> columns A,B,C; D1 will be updated to reflect the time this change
> occurs. Note that if A,B, or C contains formulas depending on data
> outside of those columns, a change in such external data will trigger a
> change in the *computed* value in columns A,B,C without firing this
> macro. For that - you would also have to monitor the correpsonding
> external inut cells for change.
>
> Hope that helps
>
> -John Coleman
> john wrote:
> > All:
> >
> > I have a simple spreadsheet where a user can enter values into columns
> > A, B or C. In column D, I would like to place the current date and time
> > (NOW()) if the data in A, B or C changes in any way. Is there a formula
> > I can use to do this, or do I need to resort to developing an
> > add-in/code.
> >
> > Thanks,
> > jpuopolo