A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi Please see below the lines where tagged them as 1----
Sub test()
'
' test Macro
' Format table
'
' Keyboard Shortcut: Ctrl+z
'
Rows("1:2").Select
Range("M1").Activate
Selection.Delete Shift:=xlUp
Columns("A:E").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Selection.ClearContents
Range("A1:A5").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A1:G1").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A1:G5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlHairline
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlHairline
End With
Range("A1:G1").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlHairline
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B1").Select
ActiveCell.FormulaR1C1 = "Month Actual"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Month Budget"
Range("A2").Select
ActiveCell.FormulaR1C1 = "Inv_Gain: (In Thousands)"
Range("I3").Select
Columns("A:A").ColumnWidth = 22.45
Range("A1:B1").Select
Range("B1").Activate
Columns("A:A").ColumnWidth = 22
Rows("1:1").RowHeight = 27.5
Range("M2").Select
ActiveCell.FormulaR1C1 = "¦??"
Range("A3").Select
1---- ActiveCell.FormulaR1C1 = "¦ Inventory Value Adjustment Gain"
Range("A4").Select
1---- ActiveCell.FormulaR1C1 = "¦ Gain-Price Difference"
Range("A5").Select
1---- ActiveCell.FormulaR1C1 = "¦ Gain-Inventory Variance"
Range("A3:A5").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 2
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A3:A5").Select
Selection.Font.Italic = True
Columns("A:A").ColumnWidth = 24.45
Columns("A:A").ColumnWidth = 24.73
Range("A2:G5").Select
With Selection
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:A").ColumnWidth = 26.91
Columns("A:A").ColumnWidth = 30.73
Columns("A:A").ColumnWidth = 28.45
Range("A2").Select
Selection.Font.Bold = True
Range("B2:C5,E2:F5").Select
Range("E2").Activate
Selection.NumberFormat = "#,##0 ; (#.00,)K"
Range("D2:D5,G2:G5").Select
Range("G2").Activate
1----Selection.NumberFormat = "[Red]#.00,"" ?"" ;[Color10] (#.00,)"" ?
Range("B2:G5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("G2").Select
Columns("G:G").ColumnWidth = 13.91
Columns("E:E").ColumnWidth = 12.45
Columns("D:D").ColumnWidth = 13.55
Columns("D:D").ColumnWidth = 12.09
Range("B1:G1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("C:C").ColumnWidth = 10.91
Range("B1").Select
End Sub