Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Application.EnableEvents = False Range("B1").Value = Date Application.EnableEvents = True End Sub This is worksheet code it goes in the worksheet code area, NOT a standard module. -- Gary''s Student - gsnu200749 "Shahid" wrote: Hello, Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks..that works great..
Another follow on question would be: Could I be done to a whole column...so that every time you change an entry on each row, it updates the date in the column besides it. thanks "Gary''s Student" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Application.EnableEvents = False Range("B1").Value = Date Application.EnableEvents = True End Sub This is worksheet code it goes in the worksheet code area, NOT a standard module. -- Gary''s Student - gsnu200749 "Shahid" wrote: Hello, Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes. We change two lines of code:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub Application.EnableEvents = False Target.Offset(0, 1).Value = Date Application.EnableEvents = True End Sub -- Gary''s Student - gsnu200749 "Shahid" wrote: Thanks..that works great.. Another follow on question would be: Could I be done to a whole column...so that every time you change an entry on each row, it updates the date in the column besides it. thanks "Gary''s Student" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Application.EnableEvents = False Range("B1").Value = Date Application.EnableEvents = True End Sub This is worksheet code it goes in the worksheet code area, NOT a standard module. -- Gary''s Student - gsnu200749 "Shahid" wrote: Hello, Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
again works great..
another follow on question :-) At present I've got it running with F:F being updated and a date being inserted into G:G. Could I also have it doing the same thing on the same sheet for G:G to H:H, I:I to J:J etc.. I tried to copy the code and edit it to give each module uniqueness but that didn't work... "Gary''s Student" wrote: Yes. We change two lines of code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub Application.EnableEvents = False Target.Offset(0, 1).Value = Date Application.EnableEvents = True End Sub -- Gary''s Student - gsnu200749 "Shahid" wrote: Thanks..that works great.. Another follow on question would be: Could I be done to a whole column...so that every time you change an entry on each row, it updates the date in the column besides it. thanks "Gary''s Student" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Application.EnableEvents = False Range("B1").Value = Date Application.EnableEvents = True End Sub This is worksheet code it goes in the worksheet code area, NOT a standard module. -- Gary''s Student - gsnu200749 "Shahid" wrote: Hello, Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How did you edit it?
On Oct 9, 9:16 am, Shahid wrote: again works great.. another follow on question :-) At present I've got it running with F:F being updated and a date being inserted into G:G. Could I also have it doing the same thing on the same sheet for G:G to H:H, I:I to J:J etc.. I tried to copy the code and edit it to give each module uniqueness but that didn't work... "Gary''s Student" wrote: Yes. We change two lines of code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub Application.EnableEvents = False Target.Offset(0, 1).Value = Date Application.EnableEvents = True End Sub -- Gary''s Student - gsnu200749 "Shahid" wrote: Thanks..that works great.. Another follow on question would be: Could I be done to a whole column...so that every time you change an entry on each row, it updates the date in the column besides it. thanks "Gary''s Student" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub Application.EnableEvents = False Range("B1").Value = Date Application.EnableEvents = True End Sub This is worksheet code it goes in the worksheet code area, NOT a standard module. -- Gary''s Student - gsnu200749 "Shahid" wrote: Hello, Wanted to know if it is possible in Excel to run a macro after updating a cell.. For example, I wanted excel to "date stamp" cell B1 (using a macro) after cell A1 has been updated. Is that possible...thanx |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating a Running total from a cell | New Users to Excel | |||
Running Macro when a cell value changes | Excel Discussion (Misc queries) | |||
running a macro when a certain cell changes | Excel Programming | |||
Run a macro when updating a cell | Excel Programming | |||
Running a macro when a cell value changes | Excel Programming |