Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Arrange_stuff()
- '
- ' Arrange_stuff Macro
- '
- ' Keyboard Shortcut: Ctrl+Shift+A
- '
- ActiveWorkbook.CheckCompatibility = False
- Range("A1").Select
- If Application.CountA(ActiveCell.EntireRow) = 0 Then
- Worksheets("Sheet1").Rows("1:4").Delete
- End If
- Cells.Select
- With Selection.Font
- .Name = "Calibri"
- .Size = 10
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontMinor
- End With
- Selection.Columns.AutoFit
- Selection.Rows.AutoFit
- Range(Range("A1"), Range("A1").End(xlDown)).Select
- numRows = Selection.Count
- Range("A" & numRows).Cut Range("A" & numRows + 1)
- Application.CutCopyMode = False
- Rows(numRows).Delete
- Rows(numRows + 1 & ":" & numRows + 5).Delete
- Dim C As Integer
- C = Worksheets("Sheet1").Cells.SpecialCells(xlLastCell).Column
- Do Until C = 0
- If WorksheetFunction.CountA(Columns(C)) = 0 Then
- Columns(C).Delete
- End If
- C = C - 1
- Loop
- Dim ColumnLetter As String
- LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
- ColumnLetter = Split(Cells(1, LastColumn).Address, "$")(1)
- If Range("A" & numRows - 1) = "TOTAL" Then
- numRows = numRows - 1
- Rows(numRows + 1).Delete
- End If
- Worksheets("Sheet1").ListObjects.Add(xlSrcRange, Range("A1:" & ColumnLetter & numRows - 1), , xlYes).Name = _
- "Table1"
- Range("A1:" & ColumnLetter & numRows - 1).Select
- Worksheets("Sheet1").ListObjects("Table1").TableStyle = "TableStyleLight8"
- Range("A1:" & ColumnLetter & numRows).Select
- Selection.NumberFormat = "0.00"
- 'Borders
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Font
- .Name = "Calibri"
- .Size = 10
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontMinor
- End With
- 'Colors
- Range("A1:" & ColumnLetter & "1").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .ThemeColor = xlThemeColorDark1
- .TintAndShade = -0.249977111117893
- .PatternTintAndShade = 0
- End With
- With Selection.Font
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .Bold = True
- End With
- Range("A" & numRows & ":" & ColumnLetter & numRows).Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .ThemeColor = xlThemeColorDark1
- .TintAndShade = -0.249977111117893
- .PatternTintAndShade = 0
- End With
- With Selection.Font
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .Bold = True
- End With
- Range("A2").Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement