ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   When was this cell updated? (https://www.excelbanter.com/excel-discussion-misc-queries/224860-when-cell-updated.html)

Geoff[_3_]

When was this cell updated?
 
That's basically what I want to know.

There are two cells, say d10 and d11, and I would like to know exactly when
they are changed. So I'd like to have a couple cells directly below them that
have the now() result entered into it if the cell above it is changed and to
have it updated each time those cells are changed.

I can do this easily in Access with an OnUpdate routine, but I am a complete
moron WRT coding in Excel. Any help is greatly appreciated.

Anyhoo...I've finally made the leap to Office '07 kicking and screaming.
After two weeks, I can't believe I waited so long. Pretty slick stuff.
Getting used to the interfaces was a challenge, but well worth it.

TIA...geoff

Luke M

When was this cell updated?
 
Right click on sheet tab, view code. Paste this in, and adjust range callouts
as preferred:

Private Sub Worksheet_Change(ByVal Target As Range)

'First cell
If Target = Range("D10") Then
Range("D13").Value = Now
End If

'Second cell
If Target = Range("D11") Then
Range("D14").Value = Now
End If

End Sub

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Geoff" wrote:

That's basically what I want to know.

There are two cells, say d10 and d11, and I would like to know exactly when
they are changed. So I'd like to have a couple cells directly below them that
have the now() result entered into it if the cell above it is changed and to
have it updated each time those cells are changed.

I can do this easily in Access with an OnUpdate routine, but I am a complete
moron WRT coding in Excel. Any help is greatly appreciated.

Anyhoo...I've finally made the leap to Office '07 kicking and screaming.
After two weeks, I can't believe I waited so long. Pretty slick stuff.
Getting used to the interfaces was a challenge, but well worth it.

TIA...geoff


Geoff[_3_]

When was this cell updated?
 
OK...I'm confused.

I added the following to the code for the sheet (right-clicked the tab and
selected View Code):

Private Sub Worksheet_Change(ByVal Target As Range)

If Target = Range("G4") Then
Range("G5").Value = Now
End If

If Target = Range("H4") Then
Range(H5).Value = Now
End If

End Sub

Right away, it worked like a charm. I saved the file and I was told I needed
to save as a macro-enable workbook. No problem. Easy peasy.

I reopened the macro-enable workbook and now it doesn't work. I change the
data in either G4 or H4 and nothing happens. So I opened the code sheet.
Nothing seems amiss. So I put a breakpoint in on the first IF statement and
nothing happens when I change the data.

I just know I am doing something so mind-numbingly stupid. TIA


Geoff[_3_]

When was this cell updated?
 
OK...I see now. I clicked the Design button then enabled macros and reopened
the file. Super.

Now I am getting Run-time error '1004'.
Application-defined or object-defined error

Again...I just know I am doing something mind-numbingly stupid. Excel code
is just beyond me. TIA

"Geoff" wrote:

OK...I'm confused.

I added the following to the code for the sheet (right-clicked the tab and
selected View Code):

Private Sub Worksheet_Change(ByVal Target As Range)

If Target = Range("G4") Then
Range("G5").Value = Now
End If

If Target = Range("H4") Then
Range(H5).Value = Now
End If

End Sub

Right away, it worked like a charm. I saved the file and I was told I needed
to save as a macro-enable workbook. No problem. Easy peasy.

I reopened the macro-enable workbook and now it doesn't work. I change the
data in either G4 or H4 and nothing happens. So I opened the code sheet.
Nothing seems amiss. So I put a breakpoint in on the first IF statement and
nothing happens when I change the data.

I just know I am doing something so mind-numbingly stupid. TIA



All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com