Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cell On change

can you please show me how to run a macro after a change a cell
thank you in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Cell On change

Right click on the tab of the sheet that you would like to react to a change.
Select View Code. Thiw will open up the VB editor. Just above the code window
is a drop down list that will say General. Switch it to Worksheet. When you
do this a procedure will be added to the code window that is on selection
change (not what you want so just delete it). Jut to the right of the drop
down that now says worksheet is a drop down. Select change. A change
procedure has now been added similar to

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Add a message box to it something like this...

Private Sub Worksheet_Change(ByVal Target As Range)
msgbox "You changed " & target.address & " to " & target.value
End Sub
--
HTH...

Jim Thomlinson


"rafik" wrote:

can you please show me how to run a macro after a change a cell
thank you in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Cell On change

The macro below will run each time a value is changed by the user in any
sheet.Let me know if this what you want.Private Sub
Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
' runs when a sheet is changed
End Sub"rafik" wrote in message
...
can you please show me how to run a macro after a change a cell
thank you in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cell On change



"Richard Mertl" wrote:

The macro below will run each time a value is changed by the user in any
sheet.Let me know if this what you want.Private Sub
Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
' runs when a sheet is changed
End Sub"rafik" wrote in message
...
can you please show me how to run a macro after a change a cell
thank you in advance




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cell On change



"Richard Mertl" wrote:

The macro below will run each time a value is changed by the user in any
sheet.Let me know if this what you want.Private Sub
Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
' runs when a sheet is changed
End Sub"rafik" wrote in message
...
can you please show me how to run a macro after a change a cell
thank you in advance


thank you it worked but the macro runs for all the cells

can we make it specific to one cell or a range
thank you in advance



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Cell On change

Target is the cell that changed. To run lony for specific cells or ranges you
need to use an if statement, similar to

If target.address = "$A$1" then
'do your stuff
end if

For a range you need to use the intersect function

if not intersect(target, range("A1:B10")) is nothing then
'Do your stuff
end if



--
HTH...

Jim Thomlinson


"rafik" wrote:



"Richard Mertl" wrote:

The macro below will run each time a value is changed by the user in any
sheet.Let me know if this what you want.Private Sub
Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
' runs when a sheet is changed
End Sub"rafik" wrote in message
...
can you please show me how to run a macro after a change a cell
thank you in advance


thank you it worked but the macro runs for all the cells

can we make it specific to one cell or a range
thank you in advance

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
change cell contents when pull down menu choices change jb21 Excel Worksheet Functions 3 November 21st 08 10:34 PM
making copied cells change with change in original cell Jennifer Mcdermeit Excel Worksheet Functions 2 July 20th 06 04:58 PM
excel deleting rows last cell does not change. How to change? mrubey Excel Discussion (Misc queries) 3 August 25th 05 08:38 PM
Change workbook sheet reference using cell A1 to change a vairable Reed Excel Worksheet Functions 4 January 20th 05 07:15 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 10:28 PM.

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

About Us

"It's about Microsoft Excel"