View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default VBA - Only Selected area visible

Hi Geo,

First, you would need to "zoom in" on that range, which you can do by
selecting the range and using ActiveWindow.Zoom=True. Next, you would want
to hide the rest of the rows/columns from view. Here's a quick example:

Sub test()
'/ zoom in on desired range
Application.Goto Sheet1.Range("A1:X12")
ActiveWindow.Zoom = True
'/ hide rest of cells
With Sheet1
.Range(.Range("Y1"), .Range("X1").End(xlToRight) _
).EntireColumn.Hidden = True
.Range(.Range("A13"), .Range("A13").End(xlDown) _
).EntireRow.Hidden = True
End With
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Excel VBA programming : How to make only a selected sheet area
visible, e.g. the row 12 until the end shall be invisible and the
column X until the end shall be invisible. The problem may be that
different Excel versions have different max rows and columns. And how
to adjust the scrollbars to that selected area. What if the selected
area is smaller than the usable width of the Excel spreadsheet. The
function of sizing the width and height will not work ?


---
Message posted from http://www.ExcelForum.com/