ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is there a way to disable a macro based on the value of a cell? (https://www.excelbanter.com/excel-discussion-misc-queries/179154-there-way-disable-macro-based-value-cell.html)

Jeff

Is there a way to disable a macro based on the value of a cell?
 
Is there a way to disable (or turn off) a particular macro based on the value
of a cell?

Dave Peterson

Is there a way to disable a macro based on the value of a cell?
 
Probably not. But you could put a check in the macro to see if it should
continue:

Option Explicit
Sub testme()
dim myValToCheck as variant

myvaltocheck = activesheet.range("a1").value

if ucase(myvaltocheck) = ucase("Stop") then
exit sub
end if

'real code here
End Sub


Jeff wrote:

Is there a way to disable (or turn off) a particular macro based on the value
of a cell?


--

Dave Peterson


All times are GMT +1. The time now is 02:23 PM.

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