updating date every time particular cells' contents are changed

nazatron

New Member
Joined
Mar 2, 2010
Messages
12
Hi,

I am working on a spreadsheet where I wish to have a column B where each cell shows the date on which the cell in the corresponding row of column A is manually updated by me.

In other words,

<table style="border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="484" height="128"><col style="width: 48pt;" width="64"> <col style="width: 69pt;" width="92"> <col style="width: 84pt;" span="2" width="112"> <tbody><tr style="height: 15pt;" height="20"> <td style="height: 15pt; width: 48pt;" width="64" height="20">
</td> <td style="width: 69pt;" width="92">A</td> <td style="width: 84pt;" width="112">B</td> <td style="width: 84pt;" width="112">C</td> </tr> <tr style="height: 15pt;" height="20"> <td style="height: 15pt;" align="right" height="20">1</td> <td> STATUS</td> <td>DATE PAUSED</td> <td>DATE ACTIVATED</td> </tr> <tr style="height: 15pt;" height="20"> <td style="height: 15pt;" align="right" height="20">2</td> <td> paused</td> <td>march 15,2010</td> <td>march 13,2010</td> </tr> <tr style="height: 15pt;" height="20"> <td style="height: 15pt;" align="right" height="20">3</td> <td> active</td> <td>march 14,2010</td> <td>march 15,2010</td> </tr> </tbody></table>

kind of thing if for instance I typed in "active" in one and "paused" in one today (march 15). I am updating the status of campaigns.

I attempted achieving this by typing in B2 and dragging it down:
=IF(A2="paused",NOW(),B2)
which yields a warning message regarding circular reference (because I am saying that unless the cell content becomes "paused", it returns what it already had in it, in other words the date from the last time it was paused.
Despite the warning, this has been working fine UNTIL I refreshed the data (the above table is a snippet of a huge pivot table which updates from a query). When I refresh the data, it inserts in the date cells today's date.

Ultimately, I need to have cells that update properly so we can keep a record of previous activity.
Did I make myself clear? I would really appreciate some guidance here. Thank you!!

Naz
 
Last edited:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
    Application.EnableEvents = False
    Select Case LCase(Target, Value)
        Case "paused": Target.Offset(, 1).Value = Date
        Case "active": Target.Offset(, 2).Value = Date
    End Select
    Application.EnableEvents = True
End If
End Sub

then press ALT + Q to return to your sheet.
 
Upvote 0
Sorry, stupid typo in my code. Try

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
    Application.EnableEvents = False
    Select Case LCase(Target.Value)
        Case "paused", "active": Target.Offset(, 1).Value = Date
    End Select
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top