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
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