Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Counting CheckBoxes on a Userform

I have a userform. It is increasing in complexity with
various controls in it. It has:

1 Text Box
6 checkboxes
2 buttons


Is there a way to count the number of check boxes the form
has? I know that I can count the number of total controls
by :

NumberofControls = Userform1.Controls.Count

This gives me a value of 9 which includes the text box and
the two buttons. How do I isolate the checkboxes or any
other control of my liking.


Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Counting CheckBoxes on a Userform

Off Google:

Try something like the following:

Dim Ctrl As MSForms.Control
Dim N As Long
For Each Ctrl In UserForm1.Controls
If TypeOf Ctrl Is MSForms.CheckBox Then
N = N + 1
End If
Next Ctrl


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ExcelMonkey" wrote in message
...
I have a userform. It is increasing in complexity with
various controls in it. It has:

1 Text Box
6 checkboxes
2 buttons


Is there a way to count the number of check boxes the form
has? I know that I can count the number of total controls
by :

NumberofControls = Userform1.Controls.Count

This gives me a value of 9 which includes the text box and
the two buttons. How do I isolate the checkboxes or any
other control of my liking.


Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Checkboxes gti_jobert Excel Discussion (Misc queries) 1 January 27th 06 01:21 PM
Userform with Checkboxes Greg B Excel Discussion (Misc queries) 5 November 27th 05 09:32 PM
Userform CheckBoxes ben Excel Programming 2 November 29th 04 09:59 PM
Count CheckBoxes in UserForm Lenny_821[_7_] Excel Programming 3 November 22nd 04 07:45 PM
UserForm Checkboxes MWE Excel Programming 7 January 20th 04 05:04 PM


All times are GMT +1. The time now is 12:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"