![]() FooterMargin = Application.InchesToPoints(0. HeaderMargin = Application.InchesToPoints(0.5) BottomMargin = Application.InchesToPoints(0.5) The Print Area setting is saved when you save the workbook. ![]() On the Page Layout tab, in the Page Setup group, click Print Area > Set Print Area. ![]() Heres how: Select one or more ranges that you want to print. TopMargin = Application.InchesToPoints(0.75) To ensure that Excel prints a specific part of your spreadsheet and not all the data, set the print area. RightMargin = Application.InchesToPoints(0.75) LeftMargin = Application.InchesToPoints(0.75) Range(Selection, ActiveCell.SpecialCells(xlLastCell)).SelectĪ = "$A$1: $F$429" Is there a way to use a variable in place of $F$429 so that the print area is automatically set to print all active rows that contain data? Here is my current macro: When I run the macro on a larger workbook, the print area ends on row 429 and nothing past that prints. The macro seems to hardcode the “LastCell” value of the workbook (in this case F429). How can I automatically set the print area in a macro? I recorded a macro that saved the workbook, selected the cells that contained data (by selecting cell A1, then pressing Ctrl-End to go to the “LastCell”), set the print area, then sets “Fit All Columns on One Page”.
0 Comments
Leave a Reply. |