I want to print the invoice by checking one or more of the 4 checkboxes. My workbook contains 2 sheets, data sheet and the invoice sheet. My user form contains 4 checkboxes, one print Command Button and on cancell button. When i run the program, i get the error: "Select method of class failed. Following is the code in the print command button..
Private Sub OKButton_Click()
If UserForm1.CheckBox1.Value = True Then
Range("A5").Select
ActiveWorkbook.Names.Add Name:="Start", RefersToR1C1:="=Data!R5C1"
Range("Start").Select
Do While ActiveCell.Value <> Empty
If ActiveCell.Value = 1 Then ActiveCell.Range("A1:T1").Copy Range("A1")
If CheckBox1.Value = True _
Then Sheets("Invoice").Range("A62") = "Account Receivable Copy"
End If
If CheckBox2.Value = True _
Then Sheets("Invoice").Range("A62") = "Remittance Copy - Please return with payment"
End If
If CheckBox3.Value = True _
Then Sheets("Invoice").Range("A62") = "Tenant Copy"
End If
If CheckBox4.Value = True _
Then Sheets("Invoice").Range("A62") = "Tenant File Copy"
End If
If ActiveCell.Value = 1 Then Sheets("Invoice").PrintOut
If ActiveCell.Value = 2 Then ActiveCell.Offset(0, 0).Select
ActiveCell.Offset(1, 0).Select
Loop
End If
Unload UserForm1
End Sub
Hope you could help me guys.
Thanks,
vmpascual
Private Sub OKButton_Click()
If UserForm1.CheckBox1.Value = True Then
Range("A5").Select
ActiveWorkbook.Names.Add Name:="Start", RefersToR1C1:="=Data!R5C1"
Range("Start").Select
Do While ActiveCell.Value <> Empty
If ActiveCell.Value = 1 Then ActiveCell.Range("A1:T1").Copy Range("A1")
If CheckBox1.Value = True _
Then Sheets("Invoice").Range("A62") = "Account Receivable Copy"
End If
If CheckBox2.Value = True _
Then Sheets("Invoice").Range("A62") = "Remittance Copy - Please return with payment"
End If
If CheckBox3.Value = True _
Then Sheets("Invoice").Range("A62") = "Tenant Copy"
End If
If CheckBox4.Value = True _
Then Sheets("Invoice").Range("A62") = "Tenant File Copy"
End If
If ActiveCell.Value = 1 Then Sheets("Invoice").PrintOut
If ActiveCell.Value = 2 Then ActiveCell.Offset(0, 0).Select
ActiveCell.Offset(1, 0).Select
Loop
End If
Unload UserForm1
End Sub
Hope you could help me guys.
Thanks,
vmpascual