VBA Code not working when inserted with another code.

EmilVictor

New member
Joined
Oct 15, 2018
Messages
5
Reaction score
0
Points
0
Excel Version(s)
2012
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Monthly Generic Rebate")
Set pasteSheet = Worksheets("Trend")
copySheet.Range("W2:z2").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
ChDir "C:\Users\emilvictor.masa\Desktop"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Emil, OpenAfterPublish:=True


but when I am printing it. it seems that the active spreadsheet is not printing.

only 1 sheet.
 
ok I have normal sheet.

Sheet1 Sheet2 Sheet 3 Sheet 4 Sheet 5

would you be able to code for me?

thanks,
 
You have copySheet andd pasteSheet as variables. Which one do you want printed. That is the one you need to place instead of ActiveSheet.
 
Back
Top