Show only Print_area range
Hi Gwen,
If you ensure that the graph data cells are above, or to the left, of the
print area, perhaps try something like:
'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim MyPrintRng As Range
Dim FirstRow As Long
Dim FirstCol As Long
Set WB = ThisWorkbook '<<==== CHANGE
Set SH = WB.Sheets(1) '<<==== CHANGE
Set MyPrintRng = Range(SH.PageSetup.PrintArea)
SH.ScrollArea = ""
With MyPrintRng
Application.Goto .Cells(1), Scroll:=True
Worksheets(1).ScrollArea = .Address
FirstRow = .Row + .Rows.Count
FirstCol = .Column + .Columns.Count
End With
With SH
.Rows(FirstRow & ":" & Rows.Count).Hidden = True
.Columns(FirstCol).Resize(1, Columns.Count - _
FirstCol + 1).EntireColumn.Hidden = True
End With
End Sub
'<<=============
---
Regards,
Norman
"Gwen" wrote in message
.. .
Hello,
I need to have a macro that hides all the rows and colums that is not part
of a print area on a sheet.
My print area has graphs, and I tried to hide the rows or columns that
contain the datas, and the graphs disappear.
Is there a solution for this?
Thanks.
|