Hide/Unhide Selected Rows

ciaran3

New Member
Joined
Apr 24, 2015
Messages
8
Should be fairly simple (think I'm just having a brain fart) - I want to hide/unhide certain rows based on cells values in another table (and I'd iterate through this table) to hide/unhide throughout the document.

Cells(2,y) is the starting row, Cells(3,y) is the ending row - I want to hide all rows between those two values (eg Cells(2,y) = 10, Cells (3,y) = 20, hide rows 10-20).

Just missing something obvious in the bolded row.

For x = 4 To 10
For y = 6 To 10
If Sheets("Data").Cells(x, y) = "X" Then
Rows(Cells(2, y),Cells(3,y)).EntireRow.Hidden = True
End If
Next y
Next x
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try
Code:
Rows(Cells(2, y) [COLOR=#0000ff]& ":" &[/COLOR] Cells(3, y)).EntireRow.Hidden = True
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,286
Members
449,218
Latest member
Excel Master

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