Hide Columns

Solved/Closed
wliang Posts 41 Registration date Thursday June 16, 2011 Status Member Last seen May 7, 2014 - Aug 23, 2011 at 03:31 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 23, 2011 at 05:31 AM
Hello,
I recorded a macro to hide some columns (says, column M to O). However, when I tried to run the macro again, the macro hide all the columns from A to O. Below is the code for the macro.

Sub Macro9()

ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
Columns("M:O").Select
Range("M2").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.LargeScroll ToRight:=-1
Range("E8").Select
End Sub

Please help and advice.

Thank you.

Best regards,
wliang

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Aug 23, 2011 at 05:31 AM
this macro will do

Sub test()
Range("M1:O1").EntireColumn.Hidden = True
End Sub
0