Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi there,
Could anyone possible tell me how to use VBA to delete the text from text boxes i have on my worksheet.
These are just standard textboxes, not sure if they are referred to as shapes.
I have multiple textboxes so would ideally want the code to run through them all and delete the content only.
I have some code that I already use for activex textboxes, option button and comboboxes
Thanks in advance for your help,
Mike
Could anyone possible tell me how to use VBA to delete the text from text boxes i have on my worksheet.
These are just standard textboxes, not sure if they are referred to as shapes.
I have multiple textboxes so would ideally want the code to run through them all and delete the content only.
I have some code that I already use for activex textboxes, option button and comboboxes
VBA Code:
Dim oCtrl As OLEObject
Dim shp As Shape
For Each oCtrl In ActiveSheet.OLEObjects
If TypeOf oCtrl.Object Is MSForms.TextBox Or _
TypeOf oCtrl.Object Is MSForms.ComboBox Then
oCtrl.Object.Value = ""
ElseIf TypeOf oCtrl.Object Is MSForms.OptionButton Then
oCtrl.Object.Value = False
End If
Next oCtrl
Thanks in advance for your help,
Mike