Salary_Sheet Macro VBA


Uncategorized

Updated Nov 6th, 2021

Overview of Steps:

Working

Sub SalarySheet()
'
' SalarySheet Macro
'

'
    Range("B:B,D:D,G:G").Select
    Range("G1").Activate
    Selection.Delete Shift:=xlToLeft
    Columns("A:A").Select
    Selection.Cut
    Columns("C:C").Select
    Selection.Insert Shift:=xlToRight
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Pos"
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "Salary"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "Team"
    Range("F1").Select
    ActiveCell.FormulaR1C1 = "PPG"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = "PROJ"
    Range("H1").Select
    ActiveCell.FormulaR1C1 = "CPP"
    Columns("C:C").Select
    Selection.Delete Shift:=xlToLeft
    Columns("A:A").Select
    Columns("A:A").EntireColumn.AutoFit
    Columns("B:G").Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("A1").Select
End Sub
Sub Parse()
'
' Parse Macro
' Convert Player Data Rows to JavaScript Objects
'

'
    Sheets("SALARY").Select
    Sheets("SALARY").Name = "_PARSE"
    Range("A:A,B:B,C:C,D:D,E:E,F:F,G:G").Select
    Range("G1").Activate
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Rows("1:1").Select
    Selection.Delete Shift:=xlUp
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "{name:"""
    Range("C1").Select
    ActiveCell.FormulaR1C1 = """, pos:"""
    Range("E1").Select
    ActiveCell.FormulaR1C1 = """, salary:"
    Range("G1").Select
    ActiveCell.FormulaR1C1 = ", team:"""
    Range("I1").Select
    ActiveCell.FormulaR1C1 = """, ppg:"
    Range("K1").Select
    ActiveCell.FormulaR1C1 = ", proj:"
    Range("M1").Select
    ActiveCell.FormulaR1C1 = ", cpp:"
    Range("O1").Select
    ActiveCell.FormulaR1C1 = "},"
    Range("O2").Select
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("A1").Select
    Selection.AutoFill Destination:=Range("A1:A197")
    Range("A1:A197").Select
    Range("C1").Select
    Selection.AutoFill Destination:=Range("C1:C197")
    Range("C1:C197").Select
    Range("E1").Select
    Selection.AutoFill Destination:=Range("E1:E197")
    Range("E1:E197").Select
    Range("G1").Select
    Selection.AutoFill Destination:=Range("G1:G197")
    Range("G1:G197").Select
    Range("I1").Select
    Selection.AutoFill Destination:=Range("I1:I197")
    Range("I1:I197").Select
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 6
    Range("K1").Select
    Selection.AutoFill Destination:=Range("K1:K197")
    Range("K1:K197").Select
    Range("M1").Select
    Selection.AutoFill Destination:=Range("M1:M197")
    Range("M1:M197").Select
    Range("O1").Select
    Selection.AutoFill Destination:=Range("O1:O197")
    Range("O1:O197").Select
    ActiveWindow.ScrollColumn = 5
    ActiveWindow.ScrollColumn = 4
    ActiveWindow.ScrollColumn = 3
    ActiveWindow.ScrollColumn = 2
    ActiveWindow.ScrollColumn = 1
    Range("A1").Select
End Sub

Top