#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Hide Sheet

Sub UnHideAllRowsAndColumns()
With ActiveSheet.Cells
.EntireRow.Hidden = False
.EntireColumn.Hidden = False
End With
End Sub

To work this out yourself just record a macro and then change references to
selection

"ranswert" wrote:

That worked great, now how do I unhide the worksheet?

"DomThePom" wrote:

Here's some code for you

Sub HideAroundSelection()
Dim intRows As Integer
Dim intCols As Integer
Dim rngAbove As Range
Dim rngRight As Range
Dim rngBelow As Range
Dim rngLeft As Range


intRows = Selection.Rows.Count
intCols = Selection.Columns.Count
With Selection
Set rngAbove = .Cells(1, 1)
Set rngBelow = .Cells(1, 1).Offset(intRows - 1, 0)
Set rngRight = .Cells(1, 1).Offset(0, intCols - 1)
Set rngLeft = .Cells(1, 1)

If rngAbove.Row < 1 Then
Range(rngAbove.Offset(-1, 0), .Cells(1, 1).Offset((1 - .Cells(1,
1).Row))).EntireRow.Hidden = True
End If
If rngBelow.Row < ActiveSheet.Rows.Count Then
Range(rngBelow.Offset(1, 0),
rngBelow.Offset(ActiveSheet.Rows.Count - rngBelow.Row)).EntireRow.Hidden =
True
End If
If rngRight.Column < ActiveSheet.Columns.Count Then
Range(rngRight.Offset(0, 1), rngRight.Offset(0,
ActiveSheet.Columns.Count - rngRight.Column)).EntireColumn.Hidden = True
End If
If rngLeft.Column < 1 Then
Range(rngLeft.Offset(0, -1), rngLeft.Offset(0, 1 -
rngLeft.Column)).EntireColumn.Hidden = True
End If

End With
Set rngAbove = Nothing
Set rngRight = Nothing
Set rngBelow = Nothing
Set rngLeft = Nothing


End Sub


"ranswert" wrote:

What is the best way to hide everything above, below and the the right of a
range of cells? The range will change depending on what is selected.
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
Create Sheet, Hide Sheet Dave Excel Discussion (Misc queries) 2 October 30th 07 03:40 PM
Hide Sheet when another sheet is chosen AJ Excel Programming 2 October 10th 07 08:28 AM
hide sheet geebee Excel Programming 4 September 13th 07 10:34 PM
Hide sheet - Help Les Stout[_2_] Excel Programming 4 April 12th 07 01:57 PM
hide sheet? uncheck sheet tabs? or ??? NetComm888 Excel Programming 1 February 10th 04 04:38 AM


All times are GMT +1. The time now is 07:02 PM.

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

About Us

"It's about Microsoft Excel"