D
Dean
I have the following macro below that prints out from column A thru DS (at
least it does without the first two lines of code (using "lastcolumn") that
I just added because I want you to help me integrate them into the macro).
It works fine, but in most cases, many of the rightmost columns to the right
are all zeroes, etc. In that case, I want to use a parameter to tell it to
only print the first so many leftmost columns.
Sub PrintTotalCFCityView()
Dim lastcolumn
lastcolumn = Max(Sheets("totalCF").Range("C405"),
Sheets("totalCF").Range("C408"),119).
Sheets("TotalCF").Select
Range("A1S431").Select
Selection.Printout Copies:=1, Collate:=True
Application.Goto Reference:="R1C1"
Range("A3").Select
End Sub
Columns A thru C always get printed and, beginning in column D, in the first
row, is a counter that counts the number of months from left to right. So,
cell D1 shows 0 (for month zero) and Cell E1 shows 1, cell F1 shows 2 ...
column DS shows 119.
Hoping that my syntax is correct for the "lastcolumn" variable above, I'd
like to use that variable (which should produce a number like, say, 44) to
replace the DS column in the macro.
So, if "lastcolumn" were equal to 1, for example, I would want to print only
columns A thru E, if 2, columns A thru F, if 119, then I would want to
print all the way to column DS.
Can someone add to/rewrite the macro above, so the DS341 is changed to row
341 of a column that varies as just described, using the "lastcolumn"
dimensioned variable? Thank you very much.
Dean
least it does without the first two lines of code (using "lastcolumn") that
I just added because I want you to help me integrate them into the macro).
It works fine, but in most cases, many of the rightmost columns to the right
are all zeroes, etc. In that case, I want to use a parameter to tell it to
only print the first so many leftmost columns.
Sub PrintTotalCFCityView()
Dim lastcolumn
lastcolumn = Max(Sheets("totalCF").Range("C405"),
Sheets("totalCF").Range("C408"),119).
Sheets("TotalCF").Select
Range("A1S431").Select
Selection.Printout Copies:=1, Collate:=True
Application.Goto Reference:="R1C1"
Range("A3").Select
End Sub
Columns A thru C always get printed and, beginning in column D, in the first
row, is a counter that counts the number of months from left to right. So,
cell D1 shows 0 (for month zero) and Cell E1 shows 1, cell F1 shows 2 ...
column DS shows 119.
Hoping that my syntax is correct for the "lastcolumn" variable above, I'd
like to use that variable (which should produce a number like, say, 44) to
replace the DS column in the macro.
So, if "lastcolumn" were equal to 1, for example, I would want to print only
columns A thru E, if 2, columns A thru F, if 119, then I would want to
print all the way to column DS.
Can someone add to/rewrite the macro above, so the DS341 is changed to row
341 of a column that varies as just described, using the "lastcolumn"
dimensioned variable? Thank you very much.
Dean