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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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