![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
how do u run a macro when a particular field is changed?
pls help! |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
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, NateO [ This Message was edited by: NateO on 2002-03-19 10:05 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
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 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
can someone help me pls?
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
pls help me NateO?
|
|
|
|
|
|
#6 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
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, NateO [ This Message was edited by: NateO on 2002-03-19 10:43 ] |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
nothing happen!
|
|
|
|
|
|
#8 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Do you have your calculation mode set to automatic?
Tools->options->calculation set to automatic & click ok |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Posts: 73
|
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 ] |
|
|
|
|
|
#10 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
It's in the correct sheet code module?
It works for me, not sure what the issue is.... |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|