Help with VB

rmcdermid

New Member
Joined
Jan 17, 2008
Messages
10
Hi,

Currently I have a workbook with about 60 sheets. Many sheets contain VB that will automatically hide or show various columns and rows when those sheets are clicked. I also have a workbook wide VB that checks each of those sheets to make sure they are formatted correctly on workbook close. (Just in case they haven't been clicked.)

My problem is that my workbook VB is only making sure that the rows are formatted correctly on close. i want it to also check the columns on the individual sheets. Below is the macro I am using. Any help on making this work to check columns in addition to rows would be great.

Thanks,
Ryan

Private Sub Workbook_Open()
Dim ShArray
Dim i
Dim MyRange, c As Range

Application.ScreenUpdating = False
Application.EnableEvents = False
ShArray = Array("Sheet Names Here")
For i = LBound(ShArray) To UBound(ShArray)
Set MyRange = Sheets(ShArray(i)).Range("A3:A68")
For Each c In MyRange
Sheets(ShArray(i)).Rows(c.Row).Hidden = c.Value = "H"
Next c
Next i
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 
If clicking runs the code for each sheet maybe just run through the tabs and run the sheet code?

Code:
Sub RunThroughTabs()
Dim ws As Worksheet
Dim wsStart As Worksheet

On Error GoTo Handler:
Set wsStart = ActiveSheet
Application.ScreenUpdating = False
    
    For Each ws In Worksheets
        ws.Activate
    Next ws

Handler:
Application.ScreenUpdating = True
wsStart.Activate
ThisWorkbook.Save
End Sub
 
Upvote 0

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