#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default 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


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 76
Default 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


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"