Hide Columns

Solved/Closed
wliang Posts 41 Registration date Thursday 16 June 2011 Status Member Last seen 7 May 2014 - 23 Aug 2011 à 03:31
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 23 Aug 2011 à 05:31
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

Related:

1 response

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

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