Hi, again!
I'm on the last step of my project, and I'm probably overthinking it at this point. I am trying to set up the print area, page layout, and width to fit all columns on one page. This report is ran weekly, and the amount of data/number of rows will vary. My documents has two sheets. The first has the buttons I am going to assign the Macros to, and the second sheet has the data. I uploaded a picture in case it helps.
I found examples but it will not work. I am getting a "Compile error: Invalid or unqualified reference" while highlighting the "Sub" line.
Here is the code I tried using for the page setup:
I'm on the last step of my project, and I'm probably overthinking it at this point. I am trying to set up the print area, page layout, and width to fit all columns on one page. This report is ran weekly, and the amount of data/number of rows will vary. My documents has two sheets. The first has the buttons I am going to assign the Macros to, and the second sheet has the data. I uploaded a picture in case it helps.
I found examples but it will not work. I am getting a "Compile error: Invalid or unqualified reference" while highlighting the "Sub" line.
Here is the code I tried using for the page setup:
VBA Code:
Sub DSR_Print()
Dim lastRow As Long
lastRow = Range("A:J").SpecialCells(xlCellTypeLastCell).Row
Sheets("Data").Select
ActiveSheet.PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$:$J$" & lastRow
.FitToPagesTall = False
.FitToPagesWide = 1
End Sub