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


Excel 2003 w/Visual Basic 6.3

I have a form with many check boxes. I want to know how man
checkboxes the user has selected.

All names of checkboxes start with "chk".

I tried the following :


Code
-------------------
For Each Ctl In frmReagInv.Controls
If Left(Ctl.Name, 3) = "chk" And Ctl.Value = True Then
NumChem = NumChem + 1
End If
Next Ct
-------------------


but get the following message:

"Object doesn't support this property or method"

when


Code
-------------------
If Left(Ctl.Name, 3) = "chk" And Ctl.Value = True The
-------------------


is encountered.

Anything wrong with Ctl.Value?

Any other suggestions

--
scantor14
-----------------------------------------------------------------------
scantor145's Profile: http://www.excelforum.com/member.php...fo&userid=1476
View this thread: http://www.excelforum.com/showthread.php?threadid=38987

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Counting CheckBoxes

For Each Ctl In frmReagInv.Controls
if Typeof Ctl is MSForms.checkbox then
If Ctl.Value = True Then
NumChem = NumChem + 1
End If
End if
Next Ctl

--
Regards,
Tom Ogilvy


"scantor145" wrote
in message ...

Excel 2003 w/Visual Basic 6.3

I have a form with many check boxes. I want to know how many
checkboxes the user has selected.

All names of checkboxes start with "chk".

I tried the following :


Code:
--------------------
For Each Ctl In frmReagInv.Controls
If Left(Ctl.Name, 3) = "chk" And Ctl.Value = True Then
NumChem = NumChem + 1
End If
Next Ctl
--------------------


but get the following message:

"Object doesn't support this property or method"

when


Code:
--------------------
If Left(Ctl.Name, 3) = "chk" And Ctl.Value = True Then
--------------------


is encountered.

Anything wrong with Ctl.Value?

Any other suggestions.


--
scantor145
------------------------------------------------------------------------
scantor145's Profile:

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



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
Counting the number of checkboxes on a spreadsheet Candice H. Excel Worksheet Functions 6 May 20th 05 05:27 PM
Counting CheckBoxes on a Userform ExcelMonkey[_190_] Excel Programming 1 February 7th 05 12:54 PM
Counting Checkboxes Steven Excel Programming 5 May 17th 04 09:42 PM
Counting checkboxes with a true value Antje Crawford Excel Programming 2 November 7th 03 06:48 PM
Counting checkboxes Shamsul Excel Programming 1 August 11th 03 03:26 PM


All times are GMT +1. The time now is 05:58 PM.

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

About Us

"It's about Microsoft Excel"