Macro for hiding columns not worling

D

dzierzekr

Using the record Macro process all I want to do is select particular
columns
to hide but when I run the Macro it hides all the columns, instead of the ones
I've selected.
In the same workbook but on a different worksheet it works fine.
The code it writes on each worksheet is different.
Do I have a setting wrong on the worksheet that not code correctly?


NOT WORKING
Sub Macro1()
'
' Hide Columns Macro
'
ActiveSheet.Unprotect
Columns("I:I").Select
Range("I3").Activate
Selection.EntireColumn.Hidden = True
End Sub

WORKING
Sub Format_to_Print_1st_Week()
'
' Format_to_Print_1st_Week Macro

ActiveSheet.Unprotect
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:p,R:R").Select
Range("R1").Activate
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:p,R:R,T:T").Select
Range("T1").Activate
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 32
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:p,R:R,T:AO").Select
Range("T1").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
Rows("3:3").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=21
Rows("31:31").Select
ActiveWindow.SmallScroll Down:=18
Range("31:64,65:65").Select
Range("A65").Activate
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-57
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

thanks
Dzierzek
 
D

dzierzekr

YES I have one giant merged cell traveling all the
way across the top of my columns. Is this the problem
because the working sheet does not?
I don't have my spreadsheet on this machine to try it
right now.
thanks
Dzierzek
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top