Auto run macro depend on cell value

K

Khaled

What function runs a macro if a condition is a true?
Please , without need to run it by clicking any thing just when a cell
condition is true , it is auto run.
Thank you
 
F

FSt1

hi
you might be looking at the worksheet change event. A macro that runs when
changes are made to the sheet.
example......
Private sub Worksheet_SelectionChange(ByVal Target as range)
If Cells(1,1) >1 then
Call macro1
else
exit sub
end if
end sub

Macro1 would be your macro possible in a standard module or it could be in
the worksheet change module. more than one way to do this.

hope this helped
regards
FSt1
 
K

Khaled

FSt1 said:
hi
you might be looking at the worksheet change event. A macro that runs when
changes are made to the sheet.
example......
Private sub Worksheet_SelectionChange(ByVal Target as range)
If Cells(1,1) >1 then
Call macro1
else
exit sub
end if
end sub

Macro1 would be your macro possible in a standard module or it could be in
the worksheet change module. more than one way to do this.

hope this helped
regards
FSt1
Hi
I'm new to macro in excel
Often i record macro then edit it
I copied your answer and paste it before my macro it doesn't work
Pls, can you til me in more details what to do if i want to run macro1 if
cell a1 =5 for example
thanks in advance
 
Top