lundi 22 octobre 2018

How to clear all check boxes in a worksheet and update formulas connected to them

I currently have a VBA code which i copied from a website into my excel file to clear all the checkboxes in the Active Worksheet. However when they are unchecked, the formulas (done through VBA) which are supposed to clear the contents of certain cells when the checkboxes are unchecked are not in effect. For example: I have VBA formulas set so that If check box 1 is checked the value of a certain cell is changed to reflect certain information, and the VBA code also makes the cell contents clear when the box is unchecked. The problem with the below code is that when it is run (it does successfully uncheck the checkboxes), the values of the cells connected to those checkboxes do not clear as they are supposed to when the checkbox is unchecked. Here is the code:

Sub ClearCheckBoxes()
'Updateby Extendoffice 20161129
Dim chkBox As Excel.CheckBox
Application.ScreenUpdating = False
For Each chkBox In ActiveSheet.CheckBoxes
        chkBox.Value = xlOff
Next chkBox
Application.ScreenUpdating = True
Call SiteClear
End Sub




Aucun commentaire:

Enregistrer un commentaire