![]() |
start macro
How do I start a macro whenever the contents in a cell is added or changed?
Thanks |
start macro
hi
use the worksheet change event right click the sheet tab and from the popup select view code which will bring up the vb editor in the left combo box above the code window, select worksheet. put your code there. it will fire whenever data changes on the sheet. regards FSt1 "ranswert" wrote: How do I start a macro whenever the contents in a cell is added or changed? Thanks |
start macro
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit On Error GoTo ws_exit Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Call your_macro End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "ranswert" wrote in message ... How do I start a macro whenever the contents in a cell is added or changed? Thanks |
start macro
Hi ranswert
You can use the change event in the sheet module "YourMacroName" is the name of your sub Private Sub Worksheet_Change(ByVal Target As Range) Call YourMacroName End Sub See this page also if you have no idea where to paste this http://www.rondebruin.nl/code.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "ranswert" wrote in message ... How do I start a macro whenever the contents in a cell is added or changed? Thanks |
start macro
Is there a way to run the macro only when a certain cell is changed not the
whole sheet? "FSt1" wrote: hi use the worksheet change event right click the sheet tab and from the popup select view code which will bring up the vb editor in the left combo box above the code window, select worksheet. put your code there. it will fire whenever data changes on the sheet. regards FSt1 "ranswert" wrote: How do I start a macro whenever the contents in a cell is added or changed? Thanks |
start macro
hi
yes there is. bob just posted a solution. regards FSt1 "ranswert" wrote: Is there a way to run the macro only when a certain cell is changed not the whole sheet? "FSt1" wrote: hi use the worksheet change event right click the sheet tab and from the popup select view code which will bring up the vb editor in the left combo box above the code window, select worksheet. put your code there. it will fire whenever data changes on the sheet. regards FSt1 "ranswert" wrote: How do I start a macro whenever the contents in a cell is added or changed? Thanks |
All times are GMT +1. The time now is 04:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com