Checkbox arrays

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

New to the world of programming on an excel worksheet. I am trying to set up
an array that contains checkboxes, basically I have checkboxes on a worksheet
on three different rows and I want to scroll through the rows and use the row
number as the index number for the checkbox and pass that to another function.

Dim ChipEnabled(1 To 10) As CheckBox

Private Sub cmdLogon_Click()
Sheet4.SetUpWorkSheet
End sub

Public Sub SetUpWorkSheet()

'Assign each check box to the ChipEnabled array
Set ChipEnabled(1) = chkChipVisaEnabled
Set ChipEnabled(2) = chkChipElectronEnabled
Set ChipEnabled(3) = chkChipMastercardEnabled

End Sub

When I the code gets to the first line Set ChipEnabled(1) =
chkChipVisaEnabled I get a Type Mismatch. I don't understand why.

If this was working I could then use this as follows.

For i = 1 to sheet1.Rows.Count
Update (ChipEnabled(i).Value)
Next i

I hope you understand what I mean.
 
there are two types of Checkboxes. Change your declaration to

Dim ChipEnabled(1 To 10) As MSForm.CheckBox
 
Declare it as MSForms

Dim ChipEnabled(1 To 10) As MSForms.CheckBox

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Tom Ogilvy said:
there are two types of Checkboxes. Change your declaration to

Dim ChipEnabled(1 To 10) As MSForm.CheckBox

Thanks Tom sorted it out a treat.
 
for completeness, there was a typo

Dim ChipEnabled(1 To 10) As MSForm.CheckBox

should have been

Dim ChipEnabled(1 To 10) As MSForms.CheckBox

with an "s" on MSform

--
Regards,
Tom Ogilvy


Glad you figured it out.
--
Regards,
Tom Ogilvy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top