Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a worksheet contains about 100 textboxes, labels,
and checkboxes. I would like to clear all the text from these text boxes and labels, and uncheck all checkboxes at once. Is there a way to set these textboxes, labels, and checkboxes in an array and then using a loop to clear all the text and uncheck the checkboxes instead of writing a code for each of them (textbox1.text = "")? Thanks, milo |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Milo,
Here's a modified version of a macro that was given to me. Sub ClearMyObjects() Dim oleObj As OLEObject For Each oleObj In ActiveSheet.OLEObjects If TypeOf oleObj.Object Is MSForms.Textbox Then oleobj.Object.Text = "" ElseIf TypeOf oleObj.Object Is MSForms.Checkbox Then oleobj.Object.Value = False End If Next End Sub Note that my objects were from the Controls Toolbox. It won't work for objects from the Forms Toolbar. Tested this in Excel97 SR2 and it works. Even works on a sheet that doesn't have any objects. -- sb "milo" wrote in message ... I have a worksheet contains about 100 textboxes, labels, and checkboxes. I would like to clear all the text from these text boxes and labels, and uncheck all checkboxes at once. Is there a way to set these textboxes, labels, and checkboxes in an array and then using a loop to clear all the text and uncheck the checkboxes instead of writing a code for each of them (textbox1.text = "")? Thanks, milo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clear certain checkboxes | Excel Discussion (Misc queries) | |||
How to clear all checkboxes on a form? | Excel Worksheet Functions | |||
Macro to clear checkboxes | Excel Worksheet Functions | |||
Clear Checkboxes | Excel Discussion (Misc queries) | |||
Clear Comboboxes & Textboxes | New Users to Excel |