Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi,
I have the following bit of code which i use in a userform to reset it. I thought i would be able to use the same bit of code within a standard sheet using a command button linked to the code but it doesnt work, just throws an error at the me.control part. Would anyone know how to adapt for use within a sheet?
Many thanks in advance for your help.
I have the following bit of code which i use in a userform to reset it. I thought i would be able to use the same bit of code within a standard sheet using a command button linked to the code but it doesnt work, just throws an error at the me.control part. Would anyone know how to adapt for use within a sheet?
Many thanks in advance for your help.
VBA Code:
Private Sub CBILCReset_Click()
Dim oCtrl As Control
For Each oCtrl In Me.Controls
Select Case TypeName(oCtrl)
Case "TextBox", "ComboBox"
oCtrl.Value = ""
Case "OptionButton"
oCtrl.Value = False
End Select
Next oCtrl
End Sub