Messed up code help

ginathies8

New Member
Joined
Oct 17, 2013
Messages
27
This is the macro code that is supposed to hide columns:

Sub DanGourlie()
'
' DanGourlie Macro
' This will show all direct reports training records that Dan G has asked for.
'
' Keyboard Shortcut: Ctrl+Shift+D
'
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=3, Criteria1:= _
"Gourlie"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:= _
Array("New", "Temp", "Yes"), Operator:=xlFilterValues
ActiveWindow.SmallScroll Down:=-24
ActiveWindow.SmallScroll ToRight:=5
Columns("P:Y").Select
Selection.EntireColumn.Hidden = True
Columns("AD:AD").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=5
Columns("AI:AO").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=4
Columns("AR:AR").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=5
Columns("AU:BH").Select
Selection.EntireColumn.Hidden = True
Columns("BK:BK").Select
Selection.EntireColumn.Hidden = True
Range("E10").Select
End Sub

Instead of just the columns above being hidden everything from M-BH is hidden

Any suggestions?
Thank you.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Code:
Sub DanGourlie()
'
' DanGourlie Macro
' This will show all direct reports training records that Dan G has asked for.
'
' Keyboard Shortcut: Ctrl+Shift+D

   
    On Error Resume Next

    Range("P:Y,AD:AD,AI:AO,AR:AR,AU:BH,BK:BK").EntireColumn.Hidden = True

'
    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=3, Criteria1:= _
                                                       "Gourlie"
    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:= _
                                                       Array("New", "Temp", "Yes"), Operator:=xlFilterValues


    Range("E10").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,096
Messages
6,053,516
Members
444,669
Latest member
Renarian

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