szita2000
Board Regular
- Joined
- Apr 25, 2012
- Messages
- 101
- Office Version
- 365
- Platform
- Windows
Hi guys.
I am building a loop that will filter certain things within a date range.
I have to put some basic controls on the worksheet where the data is.
In this fashion.
What I'm trying to do is to disable the optionbuttons when the user enters a date in to the textboxes (I did not use datepicker, as I had trouble registering them on other PCs)
I would like to loop through the controls, however I can't get to them
What is the correct syntax to do this?
When I debug It gives me a type mismatch error highlighting the "OptionButton" bit.
Thanks
Thomas
I am building a loop that will filter certain things within a date range.
I have to put some basic controls on the worksheet where the data is.
In this fashion.
What I'm trying to do is to disable the optionbuttons when the user enters a date in to the textboxes (I did not use datepicker, as I had trouble registering them on other PCs)
I would like to loop through the controls, however I can't get to them
What is the correct syntax to do this?
When I debug It gives me a type mismatch error highlighting the "OptionButton" bit.
VBA Code:
Option Explicit
Sub test()
Dim ctrl As OLEObject
For Each ctrl In Worksheets("CL Check List File").OLEObject
Debug.Print ctrl.Name
If TypeName(ctrl) Is "OptionButton" Then
ctrl.Enabled = False
End If
Next ctrl
End Sub
Thanks
Thomas