Displaying selected rows & columns

ccameron

Board Regular
Joined
Jul 3, 2010
Messages
226
Hi everyone,
Just wondering how to make only certain rows and columns visible.
I would like to be able to have rows 1 to 20 and columns A to M visible, and the rest disapear. I have seen it on other worksheets and would like to know how to do it with some of my sheets, any help would be appreciated.

Thanks in advance
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try this

Code:
Sub Hidestuff()
Rows("21:" & Rows.Count).Hidden = True
Range(Cells(1, 14), Cells(1, Columns.Count)).EntireColumn.Hidden = True
End Sub
 
Upvote 0
For the columns you could also use:
Code:
Columns(14).Resize(, Columns.Count - 13).Hidden = True

Or, longer code but less of trying to work out the row/columns numbers that you are trying to hide and a more positive approach to what you want to show, especially if the range isn't bounded by 2 edges of the worksheet like the OPs example:
Code:
Sub ShowRangeOnly()
    With Cells
        .EntireColumn.Hidden = True
        .EntireRow.Hidden = True
    End With
    With Range("G8:M20")
        .EntireRow.Hidden = False
        .EntireColumn.Hidden = False
        .Cells(1, 1).Select
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

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