Hi there,
I am trying to get this to work but something is not right in the code but I don't know what can anone help?
The code is Option Explicit
'This also illustrates the method of referring to cells
'by using "Shortcut Notation" where, for example,
'Range("A1") can be written simply as [A1]
'(Read the VBA Help files for more on this...)
Sub PrintInvoice()
Sheet1.[A1:J66].PrintOut
PrintContinuation:
Sheet7.[A1:J66].PrintOut
Dim Response
Response = MsgBox("Is there a continuation sheet?", _
vbYesNo + vbQuestion, "Confirmation")
If Response = vbNo Then
FillSalesList
NewInvoice
NewContinuation
Else
GoTo PrintContinuation
End If
Sheet1.Unprotect
'Increment the invoice number'
[J3] = [J3] + 1
Sheet1.Protect
End Sub
'This saves details of the invoice on another sheet
Private Sub FillSalesList()
With Sheets("Sales").Columns(1).Rows(65536).End(xlUp)
.Offset(1, 0) = Sheet1.[J3]
.Offset(1, 2) = Sheet1.[J5]
.Offset(1, 3) = Sheet1.[J9]
.Offset(1, 4) = Sheet7.[J55]
.Offset(1, 5) = Sheet7.[J56]
.Offset(1, 6) = Sheet7.[J57]
.Offset(1, 7) = Sheet1.[J1]
.Offset(1, 8) = Sheet1.[J16].Text
End With
End Sub
'Clears the invoice sheet
Sub NewInvoice()
With Sheet1
.Unprotect
Cells.Locked = False
[A19:I19, I1:I17, J3, I43:J45, I50:I54, B50:B54, J10:J14].Locked = True
'Clear details of last sale
[A20:J41, J5, J9, J16, B49, I49].ClearContents
[B12].Select
.Protect
End With
End Sub
Sub NewContinuation()
With Sheet7
.Unprotect
Cells.Locked = False
[A11:J11, I1:I10, I55:J57].Locked = True
'Clear details of last sale
[A12:J53].ClearContents
[B12].Select
.Protect
End With
End Sub
I've attached the spreadsheet. I want it to print the purchase oder, ask if there is a continuation sheet if yes print that sheet. Transfer PO number, Client, Supplier, Date and the totals from PO if only one sheet or contiuation sheet if there is one onto the sales sheet then clear the sheets increment the PO number
I'm sure its not as confusing as I've made it.
I appreciate anyones help!
Thanks
Libby
Bookmarks