Can cell range be made hidden or visible similar to entire column?

dejeud

New Member
Joined
Aug 10, 2012
Messages
15
I would like to have a certain range visible or hidden.
Similar to entire columns/rows, but only the range. Let's say B2:F10
Is this possible?
Thank you,
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The only way I know of is to change the font color of the text in the range to white. The text won't be visible in the cells but still visible in the formula bar if you click on it.
 
Upvote 0
What I want is to select a range and have those rows and columns become vuissible, and all other rows and columns to be hidden.

For instance.
I select range B1:D10
In this case what I want is row 1 through 10 and columns B through D to become visible and all other hidden.
Is it possible?
Thank you,
 
Upvote 0
Select your range and then run this macro:
Code:
Sub HideRowsCols()
    Application.ScreenUpdating = False
    Dim LastRow As Long, lCol As Long, fRow As Long, lRow As Long, fCol As Long, lColumn As Long
    lColumn = ActiveSheet.UsedRange.Columns.Count
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    With Selection
        fRow = .Cells(1, 1).Row
        lRow = .Cells(.Rows.Count, .Columns.Count).Row
        fCol = .Cells(1, 1).Column
        lCol = .Cells(.Rows.Count, .Columns.Count).Column
    End With
    If fCol > 1 Then Range(Columns(1), Columns(fCol - 1)).EntireColumn.Hidden = True
    If lColumn > lCol Then Range(Cells(1, lCol + 1), Cells(1, lColumn)).EntireColumn.Hidden = True
    If fRow > 1 Then Rows("1:" & fRow - 1).Hidden = True
    If LastRow > lRow Then Rows(lRow + 1 & ":" & LastRow).Hidden = True
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top