Hide columns in all worksheets in workbook

Vicky9063

Board Regular
Joined
Oct 27, 2005
Messages
79
Hi guys,
I have the following code which i am trying to use to hide a few of the same columns in each sheet of my workbook. However it only hides the columns in the activesheet. Is there something that I am missing?? THanks!


Code:
Sub UnhideWorksheetsktoAT()

' UnhideWorksheetsktoAT Macro
' Testing - use to open up worksheets where calcs are
'
Dim wsSheet As Worksheet
    For Each wsSheet In Worksheets
    Columns("m:Av").Select
    Selection.EntireColumn.Hidden = True
    Next wsSheet
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try

Code:
Sub UnhideWorksheetsktoAT()

' UnhideWorksheetsktoAT Macro
' Testing - use to open up worksheets where calcs are
'
Dim wsSheet As Worksheet
    For Each wsSheet In Worksheets
        wsSheet.Columns("m:Av").Hidden = True
    Next wsSheet
End Sub
 
Upvote 0
Thanks very much VoG it worked! Sorry for the late reply I havent been getting my email notifications..
cheers
vb
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,242
Members
448,951
Latest member
jennlynn

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