thestampdad
Technical User
- Nov 2, 2001
- 14
Hope someone can help me with this.
I am trying to set a print area that is 14 columns wide but can be any number of rows. The number of rows changes daily.
The print area cannot be "hard coded" it must be dynamic.
Here is my code so far:
sub printing()
ActiveSheet.PageSetup.PrintArea = ""
Range("A1"
.Select
Range("A12"
.Select
ActiveCell.Offset(0, 0).Activate
Set Top = ActiveCell.Offset(0, 0)
ActiveCell.SpecialCells(xlLastCell).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, 13).Activate
Set bottom = ActiveCell.Offset(0, 0)
Range(Top, bottom).Select
ActiveSheet.PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
End Sub()
The last statement above "ActiveCell.CurrentRegion.Address" does not work because not all of the columns have data so this statement only finds cells with data.
What st
I am trying to set a print area that is 14 columns wide but can be any number of rows. The number of rows changes daily.
The print area cannot be "hard coded" it must be dynamic.
Here is my code so far:
sub printing()
ActiveSheet.PageSetup.PrintArea = ""
Range("A1"
Range("A12"
ActiveCell.Offset(0, 0).Activate
Set Top = ActiveCell.Offset(0, 0)
ActiveCell.SpecialCells(xlLastCell).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, 13).Activate
Set bottom = ActiveCell.Offset(0, 0)
Range(Top, bottom).Select
ActiveSheet.PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
End Sub()
The last statement above "ActiveCell.CurrentRegion.Address" does not work because not all of the columns have data so this statement only finds cells with data.
What st