VB CODE

K

Kanmi

Please can anybody help me check this code why is not working. If set of date
below change then Latest Update date on column "10" should automatically
change.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("14:578")) Is Nothing Then Exit Sub
If Target.Cells.Count > 10 Then Exit Sub
Application.EnableEvents = False
Cells(10, Target.Column).Value = Date
Application.EnableEvents = True
End Sub
 
J

Jacob Skaria

This will work if you try to change a value from 14th row to 578th row in Row
10 this inserts the date. Is that what you are looking for.

If this post helps click Yes
 
K

Kanmi

Yes that is what I'm looking but it not working.

Jacob Skaria said:
This will work if you try to change a value from 14th row to 578th row in Row
10 this inserts the date. Is that what you are looking for.

If this post helps click Yes
 
J

Jacob Skaria

It is working for me. Few thoughts.

1. Check whether macros are enabled. Set the Security level to low/medium in
(Tools|Macro|Security).

2. Hope you are trying in the same sheet. If in Sheet1 right click the sheet
tab>View Code> should show this code...

If this post helps click Yes
 
G

Gord Dibben

If you change any cell from J14:J578 then J10 will capture the date.

To test use Value = Now instead of Date then format to mm/dd/yy/ hh:mm:ss


Gord Dibben MS Excel MVP
 
S

Shane Devenshire

Hi,

Here is my guess - you have stopped the macro after the
Application.EnableEvents = False but before the line that turns it back on.
Hence your macros will not work.

Reconsider the use of those two lines - at least as far as this macro is
concerned they serve no purpose at all because the target range and the range
where you are putting the dates do not intersect.

To reactivate the macros put the following code in a module and run it

Sub MyEnable()
Application.EnableEvents = True
End Sub
 
K

Kanmi

Still not working. I think it because i stop the macro when i re-opening the
file but it not working even when i enable it back.
 
J

Jacob Skaria

Reopen application Or try Application.EnableEvents = True from the immediate
window...

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top