Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default running a macro after updating a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default running a macro after updating a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default running a macro after updating a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default running a macro after updating a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default running a macro after updating a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default running a macro after updating a cell

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
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
Updating a Running total from a cell MacPack2 New Users to Excel 1 April 11th 08 06:26 PM
Running Macro when a cell value changes Ayo Excel Discussion (Misc queries) 1 April 18th 07 03:09 PM
running a macro when a certain cell changes Jeffreak Excel Programming 0 October 6th 05 03:09 PM
Run a macro when updating a cell Jim Hartley Excel Programming 2 August 22nd 05 01:52 PM
Running a macro when a cell value changes Emea training[_2_] Excel Programming 3 August 1st 04 03:07 PM


All times are GMT +1. The time now is 02:58 AM.

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"