how do u run a macro when a particular field is changed?

LMF

Board Regular
Joined
Mar 16, 2002
Messages
73
how do u run a macro when a particular field is changed?

pls help!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
If a cell range = field in this case then:

Right click on your sheet, select view code and paste the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:b1000")) Is Nothing Then
application.run("LMF's Macro Name")
end if
end sub

Might want to change your target to something more pertinent to your worksheet.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
This message was edited by NateO on 2002-03-19 10:05
 
Upvote 0
thank you for the code, but i actually want the macro to run when the value of the cell changes. like if i do If or vlookup.

do u know what i am saying?

:)
This message was edited by LMF on 2002-03-19 10:31
 
Upvote 0
Please works for me. Try:

Right click on your sheet, select view code and paste the following:

Private Sub Worksheet_Calculate()
application.run("LMF's Macro Name")
end sub


_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
This message was edited by NateO on 2002-03-19 10:43
 
Upvote 0
Do you have your calculation mode set to automatic?

Tools->options->calculation set to automatic & click ok
 
Upvote 0
it is working now, but the thing i want it the macro to be run when a particular cell is change...

pls help!
:)
This message was edited by LMF on 2002-03-19 10:51
 
Upvote 0
It's in the correct sheet code module?

It works for me, not sure what the issue is....
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top