Macro to hide rows and columns to improve

Shadkng

Active Member
Joined
Oct 11, 2018
Messages
370
The macro below was originally 2 separate macros, one to hide rows and one to hide columns. I combined them into the one below, but I was wondering if it should be written in a better way.

Also, I use this same code in 7 other sheets where I just change the row and columns numbers. I made a macro to run all of them sequentially (see below also) but only the first one runs. Is there something in the code that terminates it? Thanks
Sub CLUTCH_BUILD_HIDE_ALL()
Dim xRg As Long
Application.ScreenUpdating = False
With Sheets("CLUTCH BUILD")
.Rows("11:20").Hidden = False
For xRg = 11 To 20
.Rows(xRg).Hidden = .Cells(xRg, 2) = "" Or .Cells(xRg, 2) = "-"
Next xRg
End With
Dim c As Range
For Each c In Range("A24:N24").Cells
If c.Value = "HIDE" Then
c.EntireColumn.Hidden = True
End If
Next c
Application.ScreenUpdating = True
End Sub

following group code

Sub ALL_HIDE()
MAST_PROD_FORM_HIDE_ALL
CLUTCH_BUILD_HIDE_ALL
TABLE_PROD_HIDE_ALL
FAS_CASS_ASSEM_HIDE_ALL
PACK_SLIP_HIDE_ALL
TACK_SEAL_HIDE_ALL
CUTTER_PROD_HIDE_ALL
ORDER_PROOF_HIDE_ALL
INVOICE_HIDE_ALL
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
You have to Call the macros to make them run...

Code:
Sub ALL_HIDE()
Call MAST_PROD_FORM_HIDE_ALL
Call CLUTCH_BUILD_HIDE_ALL
Call TABLE_PROD_HIDE_ALL
call FAS_CASS_ASSEM_HIDE_ALL
call PACK_SLIP_HIDE_ALL
call TACK_SEAL_HIDE_ALL
call CUTTER_PROD_HIDE_ALL
call ORDER_PROOF_HIDE_ALL
call INVOICE_HIDE_ALL
End Sub
 
Last edited:
Upvote 0
How are you calling the main macro Sub ALL_HIDE() ??
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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