View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default "For Each" Statement error...

Dim ctl As MSForms.Control
Dim i as long

For Each ctl In UserForm1.Controls
If TypeName(ctl) = "CheckBox" Then
i = i + 1
End If
Next

msgbox i & " checkboxes"

RBS

"pmguerra" wrote in
message ...

Hi

I'm having a little trouble with "For each"...

I want to use this statement to know the number of checkboxes in my
form, for example...

It's kind of:

dim check as checkbox

For each check in my_form

i=i+1

Next check

But it doesn't work... I don't know if I'm using the statement
correctly...


--
pmguerra
------------------------------------------------------------------------
pmguerra's Profile:
http://www.excelforum.com/member.php...o&userid=14986
View this thread: http://www.excelforum.com/showthread...hreadid=560898