Rayne
asked on
Clear data on all unchecked Excel
I was wondering if its possible to CLEAR ANY CONTENT ROWS OFF THE MAINvIEWsHEET if all the boxes and checkboxes are unchecked. Code going through all controls is Like this...
Dim ctl As CheckBox
Dim ctl1 As OLEObject
Dim bSelected As Boolean
bSelected = False
'Check CheckBox
For Each ctl In Sheet1.CheckBoxes
If ctl.Value = 1 Then 'Checked
bSelected = True
End If
Next ctl
'Check Togglebutton
For Each ctl1 In Sheet1.OLEObjects
If TypeOf ctl1.Object Is ToggleButton Then
If ctl1.Object.Value Then
bSelected = True
End If
End If
Next ctl1
If Not bSelected Then
MsgBox "All unchecked"
End If
Dim ctl As CheckBox
Dim ctl1 As OLEObject
Dim bSelected As Boolean
bSelected = False
'Check CheckBox
For Each ctl In Sheet1.CheckBoxes
If ctl.Value = 1 Then 'Checked
bSelected = True
End If
Next ctl
'Check Togglebutton
For Each ctl1 In Sheet1.OLEObjects
If TypeOf ctl1.Object Is ToggleButton Then
If ctl1.Object.Value Then
bSelected = True
End If
End If
Next ctl1
If Not bSelected Then
MsgBox "All unchecked"
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Dave,
Lost my internet connection for a day. I got your solution now. Thank you so much for being so helpful.
Rayne
Lost my internet connection for a day. I got your solution now. Thank you so much for being so helpful.
Rayne
ASKER
Your style of explanation makes it very easy to understand
ASKER
Dave,
I have posted another question.
https://www.experts-exchange.com/questions/27686994/Rename-Named-Range.html
R
I have posted another question.
https://www.experts-exchange.com/questions/27686994/Rename-Named-Range.html
R
ASKER
Hi Dave,
If you have a chance…this is another question..you may look here….
https://www.experts-exchange.com/questions/27687145/Search-excel-sequence.html?anchorAnswerId=37881586#a37881586
Thank you
If you have a chance…this is another question..you may look here….
https://www.experts-exchange.com/questions/27687145/Search-excel-sequence.html?anchorAnswerId=37881586#a37881586
Thank you
ASKER
https://www.experts-exchange.com/questions/27667021/Add-new-fileds-to-filter-layers-Excel.html