![]() |
Cell On change
can you please show me how to run a macro after a change a cell
thank you in advance |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com