• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

vba code for printout using check box

rararara

New Member
Hi,

Good Day!

i am new in using VBA, i have 5 sheets, i need to print sheet 2,3,4,5 using check box in sheet 1 and a command button "print out". hoping for your help.


POST MOVED BY MODERATOR


.
 
Last edited by a moderator:
Hi there,

Maybe something like this:

Code:
Sub Printselected()

    Dim i As Integer
  
    For i = 2 To 5
        If Sheets("Printselection").Shapes("Check Box " & i).ControlFormat.Value = 1 Then
            Sheets("Sheet" & i).PrintOut Copies:=1
        End If
    Next i
  
End Sub

See attached file... Hope it helps
 

Attachments

  • PrintMacro.xlsm
    26.3 KB · Views: 9
hi there i tried to input the code you have provided but there's an error message "run time error "9" subscript out of range
 
hi there i tried to input the code you have provided but there's an error message "run time error "9" subscript out of range

Hi,

That is because of the names of the sheets or the checkboxes... my approach used names on the code, which may not work if they are different.

If you wish me to change the code for your specific case, please provide a file and i will gladly take a look at it.
 
Last edited:
Hi;
well, I think a minor modification would do the job
pls. see the attached

Regards
 

Attachments

  • PrintMacro.xlsm
    25.9 KB · Views: 8
Hi guys.

thank you so much for helping me out here.kindly check the sample file.
 

Attachments

  • CHECK BOX.xlsx
    19.4 KB · Views: 3
Back
Top