Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA excel Help

Status
Not open for further replies.

eilob

Programmer
Mar 28, 2007
54
IE
Hi all, I am working using vba in Excel. basically I have a form with two sections and both contain check buttons. I need some code to be able to get all possible combinations and paste a range of cells if certain check boxes are selected. Please if you could help me with some type of structure for the code will be great, Thanks a lot!Eileen
 


Hi, Eileen,

Would you please be more specific, that is, if you want specific help.

Otherwise, a general answer to your question, "Please if you could help me with some type of structure for the code will be great," could be, "Yes, some sort of help, might be available, under some kind of unknow conditions in the murky future."

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
The most logical way would be to use a For Each loop on the collection. But with my limited experience with form controls, I don't know how to target the collection.

So what you can do, is name each of the checkboxes in the VBA Properties window. Something nice and imaginative like "cbxFilterByName", "cbxFilterByType", etc

Then, in your code...

Code:
...
If myworksheet.cbxFilterByName.Value Then 'The Value is either true or false
  'Do stuff
End If
If myworksheet.cbxFilterByType.Value Then
  'Do other stuff
End If
...

Hopefully, someone else will come along and tell us how to pull up the collection before too long, because this method is kinda tedious.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top