ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print ranges based on cell value (https://www.excelbanter.com/excel-programming/370986-print-ranges-based-cell-value.html)

John

Print ranges based on cell value
 
I'm trying to create a button attached to a Macro that will print a constant
range of cells for a header, and several variable ranges depending on the
value of a particular cell in each variable range, and a selection of a
constant range for a footer.

PROBLEM, I have read the VBA for dummies and well, its not the right book or
I'm REALLY a dummy cause I cant figure out what I should be doing.

Any thoughts on the code I need? Or point me in the right direction??

Thanks,
John

Dan Hatola

Print ranges based on cell value
 
John,
You will need to set the print range and then use the printout method to
print the worksheet. Here is an example:

Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$E$25"
Worksheets("Sheet1").PrintOut

Note: There are a lot of print settings that can be changed using VBA. I
recommend recording a macro and then going and looking at the code that is
generated for ideas.

Dan

"John" wrote:

I'm trying to create a button attached to a Macro that will print a constant
range of cells for a header, and several variable ranges depending on the
value of a particular cell in each variable range, and a selection of a
constant range for a footer.

PROBLEM, I have read the VBA for dummies and well, its not the right book or
I'm REALLY a dummy cause I cant figure out what I should be doing.

Any thoughts on the code I need? Or point me in the right direction??

Thanks,
John



All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com