Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
Does anyone know how to stop all the code working in a workbook b
clickin an added button and then allowing the code to be active agai on the next click of that button? Thanks! Simo -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
That is not too hard....
Public StartStopCode As Boolean Private Sub Button_Click() If StartStopCode = True Then StartStopCode = False Else: StartStopCode = True End If End Sub Private Sub MyCode() If StartStopCode = False Then ' Your code here End If End Su -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
Thanks Berend, but im fairly new to this and the first part of the cod
looks like a loop startstopcode=True Then startstopcode=False, als where do i put this?...in the Thisworkbook code? Hope you can advise. Simo -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
One way is to add a macro to the button that will put "No"
in cell A1 for example Sub test() With Sheets("Sheet1").Range("A1") If .Value = "No" Then .Value = "Yes" Else .Value = "No" End If End With End Sub And in all your other macro's add this line at the top If Sheets("Sheet1").Range("A1").Value = "No" Then Exit Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Simon Lloyd " wrote in message ... Does anyone know how to stop all the code working in a workbook by clickin an added button and then allowing the code to be active again on the next click of that button? Thanks! Simon --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
Ron Can that .Value=0 be in any cell i choose, need the code to b
disabled because i have a lot of worksheet selection_change code s when on the spread sheet you try to drag and select rows and or column the events try to take place and crash the program thats why i need t add a button to the menubar that turns of this code until presse again! Simo -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
Just put the whole code in the code of the worksheet the button (and th
data) is on. It should work then -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling code using a button?
Ron Can that .Value=0 be in any cell i choose
yes you can choose the cell You can disable events like this also Application.EnableEvents = False -- Regards Ron de Bruin http://www.rondebruin.nl "Simon Lloyd " wrote in message ... Ron Can that .Value=0 be in any cell i choose, need the code to be disabled because i have a lot of worksheet selection_change code so when on the spread sheet you try to drag and select rows and or columns the events try to take place and crash the program thats why i need to add a button to the menubar that turns of this code until pressed again! Simon --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disabling Excel X Application Button | Excel Programming | |||
disabling a command button | Excel Programming | |||
VB code for disabling | Excel Programming | |||
disabling cells based on cmd button | Excel Programming | |||
Disabling font color button | Excel Programming |