Macro Hides columns During Execution

Houstonwolf

Board Regular
Joined
Jul 28, 2006
Messages
154
Hello. I created the following macro using the recorder. I have made no modifications. It works the way I want until I save it in PERSONAL.xls and close Excel. The next time it runs, it hides all the columns except for L & M. I say it hides them, but I can't unhide them.

The first time it happened, I deleted the macro and rerecorded it exactly the same way. Again, it works just fine until I close Excel and then re-open and try to use it again. Any suggestions as to what I'm doing wrong or what mods I need to make so it will run correctly each time?

Sub StoreDoorSetup()
'
' StoreDoorSetup Macro
' Macro recorded 9/14/2006 by Houston Wolf
'
' Keyboard Shortcut: Ctrl+m
'
Columns("A:A").Select
Range("A2").Activate
Selection.EntireColumn.Hidden = True
Columns("C:F").Select
Range("C2").Activate
Selection.EntireColumn.Hidden = True
Columns("L:M").Select
Selection.ClearContents
Range("A1:K1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("J3").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A1:K86").Sort Key1:=Range("J3"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("L2").Select
Selection.ClearComments
Range("L2").Select
ActiveCell.FormulaR1C1 = "SKU"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("M2").Select
ActiveCell.FormulaR1C1 = "PO"
Columns("B:M").Select
ActiveSheet.PageSetup.PrintArea = "$B:$M"
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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