I need help with the part of this code thats in red. Everything else works perfectly but I can't get this last part to work. i would also like to shorten the part in red as well.
Rich (BB code):
Sub printdatasheet()
Application.ScreenUpdating = False
'Add temp test test
Sheets("Test Sheet").Columns("w:w").Copy
Sheets("Data Sheet").Range("ProductInfo").Insert Shift:=xlToRight
Application.GoTo Reference:=Worksheets("Data Sheet").Range("C2")
'need to select the range between the two notes range, merge and
'center and then add Quality Control Data Sheets into the Range
Sheets("Data Sheet").Range(Range("Notes1").Offset(, 1), Range("FTIRDesc").Offset(, -1)).Select
Application.ScreenUpdating = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection.Font
.Name = "Monotype Corsiva"
.FontStyle = "Regular"
.Size = 22
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("H2:K2").Select
ActiveCell.FormulaR1C1 = "Quality Control Data Sheet"
Range("H3").Select
'Print MDF and Data Sheet
Dim X As Integer
Dim Y As Integer
START:
On Error GoTo ERROR1
X = InputBox("HOW MANY COPIES OF THE DATA SHEET WOULD YOU LIKE?", "COPIES?")
Y = InputBox("HOW MANY COPIES OF THE MDF SHEET WOULD YOU LIKE?", "COPIES?")
If X = 0 Then
GoTo PRINTMDF
Else
'print Data
Sheets("Data Sheet").PrintOut Copies:=X, Collate:=True
Range("D5").Select ''''???
End If
'Print MDF
PRINTMDF:
If Y = 0 Then
Exit Sub
Else
Sheets("MDF").PrintOut Copies:=Y
End If
Exit Sub
ERROR1:
MsgBox ("Please enter only numeric values")
GoTo START:
Cells.find(What:="TEMP", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.EntireColumn.Delete
End Sub
Last edited by a moderator: