Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete names except Print_Area | Excel Programming | |||
Deleting all Range Names except Print_Area? | Excel Programming | |||
Print_Area link problem | Excel Programming | |||
protect print_area? | Excel Programming | |||
Print Ranges when Print_Area not set | Excel Programming |