|
-
Sep 30th, 2014, 12:12 PM
#1
Re: Excel VBA: Macro to hide columns not working
 Originally Posted by vbfbryce
But you don't need to select the columns first, so more like this:
Code:
Sub hideCols()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Range("g1:m1").EntireColumn.Hidden = True
ws.Range("p1").EntireColumn.Hidden = True
ws.Range("t1:z1").EntireColumn.Hidden = True
Set ws = Nothing
End Sub
Bryce you work to hard!
Code:
ActiveSheet.Range("g:m, p:p, t:z").EntireColumn.Hidden = True
Or is it that you get paid by the line?
-
Sep 30th, 2014, 04:03 PM
#2
Thread Starter
Lively Member
Re: Excel VBA: Macro to hide columns not working
Thanks guys, I'm not sure why my original code wasn't working, I thought they were doing the same thing... do you have any idea why that was?? My original code was performing an entirely different operation than what I was calling for. Maybe it was because there was no Dim'ing?
Either way, I married the two of your codes together, ran it, and it works perfectly.
Here's what I used:
Code:
Sub hidecols()
Dim ws As Worksheet
Set ws = ActiveSheet
Application.ScreenUpdating = False
Call Unhide_Contra_Info
ActiveSheet.Range("g:m,p:p,t:z").EntireColumn.Hidden = True
Range("a1").Select
End Sub
Thanks again.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|