ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to query the controls in form using vb (https://www.excelbanter.com/excel-programming/308588-how-query-controls-form-using-vbulletin.html)

Andy Chan

How to query the controls in form using vb
 
I have a group of checkboxes ( about 20 ) which i created
during runtime.

I want to check the status of each checkbox in the form to
see if the value is true or false.

how do i do it ?

Thanks
Andy

Robin Hammond[_2_]

How to query the controls in form using vb
 
Andy,

try this. It's set up to run from a form control, with all check boxes names
as "chk...."

Option Compare Text
Private Sub CommandButton1_Click()
Dim ctlTest As msforms.Control
For Each ctlTest In Me.Controls
If Left(ctlTest.Name, 3) = "chk" Then Debug.Print ctlTest.Name,
ctlTest.Value
Next ctlTest
End Sub

HTH,

Robin Hammond
www.enhanceddatasystems.com

"Andy Chan" wrote in message
...
I have a group of checkboxes ( about 20 ) which i created
during runtime.

I want to check the status of each checkbox in the form to
see if the value is true or false.

how do i do it ?

Thanks
Andy





All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com