ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VB CODE (https://www.excelbanter.com/excel-worksheet-functions/235031-vbulletin-code.html)

Kanmi

VB CODE
 
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



Jacob Skaria

VB CODE
 
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
---------------
Jacob Skaria


"Kanmi" wrote:

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



Kanmi

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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



Jacob Skaria

VB CODE
 
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
tabView Code should show this code...

If this post helps click Yes
---------------
Jacob Skaria


"Kanmi" wrote:

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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



Gord Dibben

VB CODE
 
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

On Thu, 25 Jun 2009 11:09:01 -0700, Kanmi
wrote:

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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




Shane Devenshire[_2_]

VB CODE
 
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

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Kanmi" wrote:

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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



Kanmi

VB CODE
 
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.

"Shane Devenshire" wrote:

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

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Kanmi" wrote:

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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



Jacob Skaria

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

If this post helps click Yes
---------------
Jacob Skaria


"Kanmi" wrote:

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.

"Shane Devenshire" wrote:

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

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Kanmi" wrote:

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

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Kanmi" wrote:

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




All times are GMT +1. The time now is 02:25 PM.

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