Changing Checbox Values on UserForms

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

I have a userform which has over 180 checkboxes on it. Not
attractive but i couldn;t find another way.

Each column of checboxes relates to a different project. I
hide the checkboxes according to how many projects are
selected from a combobox. i also have to make the values
False otherwise they get included in my calculations on
the shet behind the form. I have coded every single
checkbox to change accordign to the drop down selection.
This has made the file size much larger. Is there a way i
can make a range of checkbox values false, or have
multiple checkboxes on one line?

(ie CheckBox17,27,37,47,57.Value = False)

Thanks in advance

Richard
 
Hi Richard,

As long as your checkboxes are all named as per Checkbox1,2,3,, etc. this
works.

Add this procedure to your form

Private Sub ResetCheckboxes(which)
Dim i As Long

For i = LBound(which, 1) To UBound(which, 1)
Me.Controls("Checkbox" & which(i)).Value = False
Next i

End Sub

and then you can clear an array of checkboxes like so

ResetCheckboxes Array(17, ,27 ,37 ,47 ,57)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Tahnks Bob, i'm getting some problems with it though - i
ahev placed the first part against (General), and the
second part within the code for the apropriate combo box.

I'm now getting an error Run-Time error 13: Type mismatch
 
Sorry Bob, forget the last post, i've just found my typo.

Thanks again
Richard
 

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