Code Help

buzz71023

Active Member
Joined
May 29, 2011
Messages
295
Office Version
  1. 2016
Platform
  1. Windows
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:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hmm... I may be missing something, but it seems to me that there's not a way to get to the part in red. In other words, your routine will exit before the red code is ever run, due to the Exit Sub code right before it.
 
Upvote 0
I had missed that too... Someone helped me with that part of the code. Thanks i'll try it before that. Thanks
 
Upvote 0
I had missed that too... Someone helped me with that part of the code. Thanks i'll try it before that. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top