Hiding list of rows in VBA

CDienst

New Member
Joined
Jul 11, 2018
Messages
31
Hello,

I'm trying to use a macro to hide (more accurately to unhide) a list of rows. I currently have it working as (without the comment markers)
Code:
         '   With Rows("62")
         '       .Hidden = Not .Hidden
         '   End With
         '   With Rows("65")
         '       .Hidden = Not .Hidden
         '   End With
         '   With Rows("66")
         '       .Hidden = Not .Hidden
         '   End With
I'm trying to condense it to something like
Code:
Sheet1.Rows("62,65,66").Hidden = False
But this leaves the rows hidden (no error)

How do I interact with a list of rows like that?

I tried something with EntireRows, but I read that that's read-only and have since assumed anything with EntireRows won't let me change stuff. Is that right?

Thanks
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try it like this...

Sheet1.Range("A62,A65:A66").EntireRow.Hidden = False
 
Last edited:
Upvote 0
Beaten2it
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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