VBA script on multiple sheets at same time?

Status
Not open for further replies.

Cgalla87

New Member
Joined
Nov 29, 2018
Messages
16
Hi.

I have a basic VBA script in a workbook of about 11 sheets. Right now the below script is running on the “financials” worksheet. I need these exact columns hidden in two other worksheets (“Total Financials” and “Current Deal”) but was hoping it could be run off of the exact same cell E9 value in “financials” tab. Essentially when the formula in E9 of the financials tab is calculated it hides the exact same columns in these three sheets. Is it easier to delete this and do one script in the ThisWorkbook? Any ideas on what I should do and the script I should use?

Private Sub Worksheet_Calculate()
With ActiveSheet
.Columns.Hidden = False
Select Case .Range(“E9”).Value
Case 36
.Range(“F:H”).EntireColumn.Hidden = True
Case 48
.Range(“G:H”).EntireColumn.Hidden = True
Case 60
.Columns(“H”).Hidden = True
Case 72
.Columns.Hidden = False
End Select
End With
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Status
Not open for further replies.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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