FrEaK_aCcIdEnT
Board Regular
- Joined
- May 1, 2012
- Messages
- 100
The code below has been peiced together and was functioning properly at one point. I can't for the life of me figure out why it wont work anymore.
I need it to do a few things.
1. Print multiple copies of a spreadsheet with the sequence number increasinging in cell "M1" on each print.
2. Based on how much of the "SRI" is filled out, print off the number of pages found in cell "J41" that is tied to a print range for for values of "1";"2;"3".
The Sequence # start is "H1"
It used to work in its current format. I was using the inputbox to determine the number of copies. I figured it would be easy to adjust it to accept x= ("M11") to make it cell based. Couldnt figure out how to deal with the left over "String" Tried "Integer" and came up with more issues. Been looking online for 2 days for something similar or that would help rack my brain to the correct modification of code...
Currently my problems with this code are... It will only print the 1st page. if there is a "1" in cell "J41". If it is a "2" or a "3" it acts like "End If"... No printing of the specified ranges.
Not sure what I did... If anyone gets a chance and wants to take a crack at it, please do. I will keep working on it. Possibly start on a clean slate with a list of what do I want it to do...
I also would like to force Ctrl+P to print. Disable the toolbar button and file menu selection. I know that goes in the workbook and in the sheet1 code. I had that to at one point, but couldnt get it to function either. Deleted it.
Thanks for any help y'all can give!
I need it to do a few things.
1. Print multiple copies of a spreadsheet with the sequence number increasinging in cell "M1" on each print.
2. Based on how much of the "SRI" is filled out, print off the number of pages found in cell "J41" that is tied to a print range for for values of "1";"2;"3".
The Sequence # start is "H1"
It used to work in its current format. I was using the inputbox to determine the number of copies. I figured it would be easy to adjust it to accept x= ("M11") to make it cell based. Couldnt figure out how to deal with the left over "String" Tried "Integer" and came up with more issues. Been looking online for 2 days for something similar or that would help rack my brain to the correct modification of code...
Currently my problems with this code are... It will only print the 1st page. if there is a "1" in cell "J41". If it is a "2" or a "3" it acts like "End If"... No printing of the specified ranges.
Not sure what I did... If anyone gets a chance and wants to take a crack at it, please do. I will keep working on it. Possibly start on a clean slate with a list of what do I want it to do...
I also would like to force Ctrl+P to print. Disable the toolbar button and file menu selection. I know that goes in the workbook and in the sheet1 code. I had that to at one point, but couldnt get it to function either. Deleted it.
Thanks for any help y'all can give!
Code:
Sub PrintSequence()
' Keyboard Shortcut: Ctrl+p'
Dim x As String
Dim SequenceNumber As Long
Dim UniqueCopies As Integer
SequenceNumber = ActiveSheet.Range("H1").Value
x = InputBox("How many Routers need a copy of the SRI?", "How Many Copies?", "1")
If Val(x) < 1 Then Exit Sub
For UniqueCopies = 1 To x
ActiveSheet.Range("H1").Value = SequenceNumber
Sheets("SRI").Select
If Range("J41").Value = 1 Then
Range("$A$1:$BV$44").PrintOut Copies:=1, Collate:=True
SequenceNumber = SequenceNumber + 1
If Range("J41").Value = 2 Then
Range("$A$1:$BV$86").PrintOut Copies:=1, Collate:=True
SequenceNumber = SequenceNumber + 1
If Range("J41").Value = 3 Then
Range("$A$1:$BV$128").PrintOut Copies:=1, Collate:=True
SequenceNumber = SequenceNumber + 1
End If
End If
End If
Next
End Sub