ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   increase print range 1 column (https://www.excelbanter.com/excel-programming/367255-increase-print-range-1-column.html)

cornman

increase print range 1 column
 
I would like to have a macro to print a daily activity sheet. The macro
needs to delete the column that is seven days old, then reset the print range
to include an additional day(today). The print range includes several
columns on the left that are printed each time.

crazybass2

increase print range 1 column
 
cornman,

Assuming on Sheet1 columns A:D are static, column E is the first "daily"
column and K is the last. So prior to today, your print range was
"A1:K(lastrow)" where lastrow is the last row in your print range. Assuming
you want to delete column E and then have the data that was in column L (now
in K) be added to the print area. You macro would look like this if your
'lastrow' 23

Sub UpdateDaily()
Sheets("Sheet1").Range("E:E").Delete
Sheets("Sheet1").PageSetup.PrintArea = "$A$1:$K$23"
End Sub

Mike


"cornman" wrote:

I would like to have a macro to print a daily activity sheet. The macro
needs to delete the column that is seven days old, then reset the print range
to include an additional day(today). The print range includes several
columns on the left that are printed each time.


Dave Peterson

increase print range 1 column
 
I don't know what column you want deleted, so I deleted column D!

Option Explicit
Sub testme02()

Dim wks As Worksheet
Set wks = Worksheets("Sheet1")

With wks
With .Range("Print_Area")
.Resize(, .Columns.Count + 1).Name = .Name.Name
End With
.Range("D1").EntireColumn.Delete
End With

End Sub

..Name gives the address (like =sheet1!$a$1:$j$999
..name.name gives the name of the range ("Print_Area")



cornman wrote:

I would like to have a macro to print a daily activity sheet. The macro
needs to delete the column that is seven days old, then reset the print range
to include an additional day(today). The print range includes several
columns on the left that are printed each time.


--

Dave Peterson

cornman

increase print range 1 column
 
Sorry, what I needed to say was hide the old column. I need to keep the
older information, so I have columns on the left that are not in the print
range, then columns that are in the print range, and among them some hidden
columns. I want to be able to print 7 consecutive days. The columns to the
right, out of the print range, have consecutive dates in them, so that cells
in the columns can remind about about future events.
THanks

"cornman" wrote:

I would like to have a macro to print a daily activity sheet. The macro
needs to delete the column that is seven days old, then reset the print range
to include an additional day(today). The print range includes several
columns on the left that are printed each time.


Dave Peterson

increase print range 1 column
 
Try changing:

..Range("D1").EntireColumn.Delete
to
..Range("D1").EntireColumn.hidden = true

cornman wrote:

Sorry, what I needed to say was hide the old column. I need to keep the
older information, so I have columns on the left that are not in the print
range, then columns that are in the print range, and among them some hidden
columns. I want to be able to print 7 consecutive days. The columns to the
right, out of the print range, have consecutive dates in them, so that cells
in the columns can remind about about future events.
THanks

"cornman" wrote:

I would like to have a macro to print a daily activity sheet. The macro
needs to delete the column that is seven days old, then reset the print range
to include an additional day(today). The print range includes several
columns on the left that are printed each time.


--

Dave Peterson


All times are GMT +1. The time now is 10:10 AM.

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