Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count CheckBoxes in UserForm


Hi All,

I've got a few CheckBoxes in a UserForm. How can I count the
CheckBoxes in VBA??

Please help:)

Lenny


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=319438

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Count CheckBoxes in UserForm

Lenny,

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



"Lenny_821" wrote in
message ...

Hi All,

I've got a few CheckBoxes in a UserForm. How can I count the
CheckBoxes in VBA??

Please help:)

Lenny


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile:
http://www.excelforum.com/member.php...o&userid=15179
View this thread:
http://www.excelforum.com/showthread...hreadid=319438



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count CheckBoxes in UserForm

Dim ctrl as MsForms.Control, cnt as Long
cnt = 0
for each ctrl in Userform1.Controls
if typeof ctrl is msforms.checkbox then
cnt = cnt + 1
end if
Next
msgbox cnt

--
Regards,
Tom Ogilvy

"Lenny_821" wrote in message
...

Hi All,

I've got a few CheckBoxes in a UserForm. How can I count the
CheckBoxes in VBA??

Please help:)

Lenny


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile:

http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=319438



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count CheckBoxes in UserForm


Works great, just what I was looking for:):)

Thanks

Lenny


Tom Ogilvy Wrote:
Dim ctrl as MsForms.Control, cnt as Long
cnt = 0
for each ctrl in Userform1.Controls
if typeof ctrl is msforms.checkbox then
cnt = cnt + 1
end if
Next
msgbox cnt

--
Regards,
Tom Ogilvy

"Lenny_821" wrote in message
...

Hi All,

I've got a few CheckBoxes in a UserForm. How can I count the
CheckBoxes in VBA??

Please help:)

Lenny


--
Lenny_821

------------------------------------------------------------------------
Lenny_821's Profile:

http://www.excelforum.com/member.php...o&userid=15179
View this thread:

http://www.excelforum.com/showthread...hreadid=319438



--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=319438

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
Can't check checkboxes in userform ... sometimes DFStoneJr Excel Programming 1 June 25th 04 02:19 AM
UserForm Checkboxes MWE Excel Programming 7 January 20th 04 05:04 PM
add multiple checkboxes to userform at runtime gkelle Excel Programming 2 October 16th 03 04:16 PM


All times are GMT +1. The time now is 06:28 AM.

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"