Button to Unhide Columns on two worksheets

Analyst232

New Member
Joined
Mar 22, 2021
Messages
6
Hi Everyone,

I am brand new to VBA/Macro. I am trying to develop a DIY forecasting template and need some help creating four buttons.

Request
I would like to create buttons to consecutively unhide a column/row (preferably within a defined range) and have this button (macro) linked to another sheet within this workbook.

Progress?
I developed Macros for each of the buttons, but it is pretty much the same Macro that works okay, but references the next active cell, does not have a defined range, and is not linked to the other worksheet.
Please see my descriptions/screenshot below and I would really appreciate any help :). Thank you!
  1. Red Button: Unhides the next single column from: Column H - AH
  2. Green Button: Unhide the next single row from: Row 8 - 16
  3. Blue Button: Unhide the next single row from: Row 18 - 32
  4. Gray Button: Unhide the single row from: Row 34 - 37
Red Button:
Sub UnhideColumn()

Sheet1.Protect Password:="pass123", UserInterfaceOnly:=True
ActiveCell.Offset(0, 1).Range("A1:A1").Columns("A:A").EntireColumn.Select
Selection.EntireColumn.Hidden = False

End Sub


Green/Blue/Gray Button:
Sub UnhideRow()
Sheet1.Protect Password:="pass123", UserInterfaceOnly:=True
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select

Selection.EntireRow.Hidden = False

End Sub


1616449597180.png
 

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.
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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