Change Macro from Running when Worksheet is Activated to Be Ran on Multiple Sheets By Button in 1 Sheet

doctorgresham

New Member
Joined
Aug 2, 2021
Messages
6
Office Version
  1. 365
Platform
  1. MacOS
Hi,
I currently have the following macro on several sheets in a workbook that runs each time the sheets are activated. I'm looking to change it from being ran each time I click on the individual sheets to being ran only when a button is clicked on Sheet 1. So in other words, I want to make a button on sheet 1 that will run the following macro on sheets 2, 3, 4 etc. when i press it. I'm a novice when it comes to VB, so any help/ideas would be greatly appreciated!

Private Sub Worksheet_Activate()
Dim cell As Range
For Each cell In Range("A1:A424")
If cell.Value = "0" Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = "1" Then
cell.EntireRow.Hidden = False
End If
Next
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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