Charlie987
New Member
- Joined
- Jul 25, 2020
- Messages
- 25
- Office Version
- 365
- Platform
- Windows
Hi,
I am trying to set the print area of a range that is dynamically created from another workbook so the end of the data will be unknown.
I was using
Sub PrintArea()
On Error Resume Next
Cells(1, 1).Select
With ActiveSheet.PageSetup
.PrintArea = Range("A1").End(xlDown).Select.Address
End With
End Sub
But because I have some empty rows with borders set at the bottom of the data, it seems to declare the the last row as where the row where the borders end even though they are technically empty.
Is there a way I can select the end of the data where the last cell with an acutal value rather than a border.
Thanks
I am trying to set the print area of a range that is dynamically created from another workbook so the end of the data will be unknown.
I was using
Sub PrintArea()
On Error Resume Next
Cells(1, 1).Select
With ActiveSheet.PageSetup
.PrintArea = Range("A1").End(xlDown).Select.Address
End With
End Sub
But because I have some empty rows with borders set at the bottom of the data, it seems to declare the the last row as where the row where the borders end even though they are technically empty.
Is there a way I can select the end of the data where the last cell with an acutal value rather than a border.
Thanks