Sub Fuel_Calculations()
'
' Fuel_Calculations Macro
' Fuel Calculations for Percentage, Total Fuel, and Fuel Breakdown
'
'
ActiveCell.FormulaR1C1 = "Percentage"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=RC[-8]/SUMIF(RC[-11]:R[4998]C[-8],RC[-11],RC[-8]:R[4998]C[-8])"
Columns("L:L").Select
Selection.NumberFormat = "0.00%"
Columns("L:L").EntireColumn.AutoFit
Range("M1").Select
ActiveCell.FormulaR1C1 = "Total Fuel"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Fuel!RC[-12]:R[4998]C[-10],'GL Paybook'!RC[-2],Fuel!RC[-10]:R[4998]C[-10])"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(Fuel!R2C1:R5000C3,'GL Paybook'!RC[-2],Fuel!R2C3:R5000C3)"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=RC[-8]/SUMIF(R2C1:R5000C4,RC[-11],R2C4:R5000C4)"
Range("N1").Select
ActiveCell.FormulaR1C1 = "Fuel Breakdown"
With ActiveCell.Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("N2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
Columns("M:N").Select
Selection.NumberFormat = "$#,##0.00"
Columns("M:N").EntireColumn.AutoFit
Range("L2").Select
End Sub
Bookmarks