Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Show only Print_area range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete names except Print_Area [email protected] Excel Programming 6 March 15th 06 08:36 PM
Deleting all Range Names except Print_Area? Nodak Excel Programming 2 May 17th 05 01:23 PM
Print_Area link problem Scott Excel Programming 3 October 15th 04 11:15 AM
protect print_area? Steven Excel Programming 1 April 22nd 04 11:32 PM
Print Ranges when Print_Area not set Dominic Robinson Excel Programming 1 September 11th 03 09:38 AM


All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"