VBA help (toggle hide/unhide rows in different worksheet)

stricker.garrett

New Member
Joined
Feb 24, 2011
Messages
3
Hello,
I have sheet 1 that will have some questions for user's to answer. The answers will be buttons, assigned to macros'. When a button is clicked, I want sheet 2 to hide/unhide assigned rows...

I can't get my simple macro to hide the correct rows and unhide the rows...

I know if i can create the macro I can then assign it to a button on sheet 1.

Any help would be very much appreciated.
 

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
Here's an example of a toggle:

Code:
Sub Test()
    With Worksheets("Sheet2")
        .Rows("6:10").EntireRow.Hidden = Not .Rows("6:10").EntireRow.Hidden
        .Columns("C:D").EntireColumn.Hidden = Not .Columns("C:D").EntireColumn.Hidden
    End With
End Sub
 
Upvote 0
if i rename the sheet2, how do i alter the code to still have it work? I've tried ("sheet2(RENAME)")
("RENAME")
("(RENAME"))

All just came back with an error.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,901
Members
452,948
Latest member
Dupuhini

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