Trying to create a for.....next loop with checkbox's

dan2

Board Regular
Joined
Mar 26, 2002
Messages
60
Hi all

Here is the loop i have written.

Dim m As CheckBox
For t = 1 To 2
m = t
If usrfrmindsht(m).Value = True Then
imgcld.Visible = True
y = "pap" & t
Workbooks.Open _ Filename:="c:flexasol" & y, Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.PrintOut
ActiveWorkbook.Close
End If
Next t

excuse the spacing.

what i am trying to do is:

I have 33 checkboxes on a userform and i want it to check each box to see if it is checked and then print out the relevant sheets to the boxes that are checked.

It chooses the right sheet but i cant get it to do the checkbox part.

Any ideas please i banging my head against a brick wall over this one.

Thanks

Dan
 
thanks a lot for the edit

after that i just had split the if and into 2 if statemnts and it works great.

Thanks again zacemmel
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top