ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Range of Cells (https://www.excelbanter.com/excel-programming/353006-hide-range-cells.html)

[email protected]

Hide Range of Cells
 
I have a comobox with serveral items in it. When you select a certain
item in the Combobox it will go to that item in the sheet and highlight
the range of cells for that item. What I would like to do is have the
all other on the page hide, and just show the selected item. How would
i go about doing that?


Thanks
Rob


Trevor Shuttleworth

Hide Range of Cells
 
Rob

maybe you could work around this:

Sub test()
Dim RangeToHide As Range
Cells.EntireRow.Hidden = False
Select Case ActiveCell.Row
Case Is = 1: Set RangeToHide = Range("A2:A65536").EntireRow
Case Is = 65536: Set RangeToHide = Range("A1:A65535").EntireRow
Case Else: Set RangeToHide = Union( _
Range("A1:A" & ActiveCell.Row - 1), _
Range("A" & ActiveCell.Row + 1 & ":A65536")).EntireRow
End Select
RangeToHide.EntireRow.Hidden = True
End Sub

Regards

Trevor


wrote in message
oups.com...
I have a comobox with serveral items in it. When you select a certain
item in the Combobox it will go to that item in the sheet and highlight
the range of cells for that item. What I would like to do is have the
all other on the page hide, and just show the selected item. How would
i go about doing that?


Thanks
Rob





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com