ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Auto run macro depend on cell value (https://www.excelbanter.com/excel-worksheet-functions/140159-auto-run-macro-depend-cell-value.html)

Khaled

Auto run macro depend on cell value
 
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


FSt1

Auto run macro depend on cell value
 
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

"Khaled" wrote:

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


Khaled

Auto run macro depend on cell value
 


"FSt1" wrote:

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

"Khaled" wrote:

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

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



All times are GMT +1. The time now is 01:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com