"reset" macro

singingsister

Board Regular
Joined
Jun 13, 2006
Messages
145
I have a large spreadsheet with a variety of macro "buttons" to hide various columns to only show certain data. What I need is to create a "reset" button, that is to say for which ever macro button someone has pressed, if they press the "reset" one, it will unhide all the columns.

How do I do it? Do I need to do a "reset" macro for each existing macro - to show the hidden columns or can I have one "reset" button that will show all regardless of what macro has been used.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
does the macro need to unhide only the last lot of hidden items or all hidden items?

if its the latter just record a macro that unhides all within the current sheet

hope this helps

Stuart

ie
Cells.Select
Selection.EntireColumn.Hidden = False
Selection.EntireRow.Hidden = False
 
Upvote 0
This will unhide all columns:

ActiveSheet.Cells.EntireColumn.Hidden = False

Maybe you should change your existing macros so that they toggle the hidden property. Example:

Code:
Private Sub CommandButton1_Click()
    With Columns("C:D")
        .EntireColumn.Hidden = Not .EntireColumn.Hidden
        If .EntireColumn.Hidden = False Then
            CommandButton1.Caption = "Hide columns"
        Else
            CommandButton1.Caption = "Unhide columns"
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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