Greetings experts,
I have this code and what it does is that it will reset all the required fields in my sheet. However, it is not resetting the ActiveX option buttons. It previously worked for the other type of option button.
The full code:
Any help is much appreciated!
I have this code and what it does is that it will reset all the required fields in my sheet. However, it is not resetting the ActiveX option buttons. It previously worked for the other type of option button.
The full code:
Code:
Sub ClearAll()
Dim rng As Range
Dim arrOptButtons, arrChkBoxes, Opt, Chk
If MsgBox("Are you sure that you want to clear all input Cells and reset the Options Buttons and CheckBoxes on the ActiveSheet?", vbQuestion + vbYesNo, "Confirm Please!") = vbNo Then
MsgBox "Action has been cancelled.", vbExclamation
Exit Sub
End If
Set rng = Range("D8, D12, D14, D16, D18, D20, D24, D32, D34, D36, D38, D40, D42, D47, D48, D51, D53, D55, D57, D62, D64, D66, D68, D70, D72, D77, D79, D81, D83, D85, D87")
rng.ClearContents
arrOptButtons = Array("Option Button 1", "Option Button 2")
arrChkBoxes = Array("Check Box 17", "Check Box 18", "Check Box 19", "Check Box 20")
With ActiveSheet
For Each Opt In arrOptButtons
With .OptionButtons(Opt)
.Value = xlOff
.LinkedCell = ""
.Display3DShading = True
End With
Next Opt
For Each Chk In arrChkBoxes
With .CheckBoxes(Chk)
.Value = xlOff
.LinkedCell = ""
.Display3DShading = True
End With
Next Chk
End With
ActiveSheet.OLEObjects.Delete
Range("B31").Select
End Sub
Any help is much appreciated!