Option Explicit
Sub Reveldata()
With ActiveSheet
.Rows("1:7").Delete Shift:=xlUp
.Columns("A:B").Delete Shift:=xlToLeft
.Columns("J:J").Delete Shift:=xlToLeft
.Cells.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
With Worksheets("Total Summary")
.Activate
With Range(.[A2], .[A2].End(xlDown))
.FormulaR1C1 = "=IF('Pivot Sheet'!R[-1]C="""","""",'Pivot Sheet'!R[-1]C)"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
With Range(.[B2], .[B2].End(xlDown))
.FormulaR1C1 = "=SUMIF(testreval!C[3],'Total Summary'!RC[-1],testreval!C[5])"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
With Range(.[C2], .[C2].End(xlDown))
.FormulaR1C1 = "=IF(RC[-2]="""","""",SUMIF(testreval!C[2],'Total Summary'!RC[-2],testreval!C[5]))"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
With Range(.[D2], .[D2].End(xlDown))
.FormulaR1C1 = "=IF(RC[-3]="""","""",IF(RC[-2]=0,0,RC[-2]/RC[-1]))"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
With Range(.[E2], .[E2].End(xlDown))
.FormulaR1C1 = "=IF(RC[-4]="""","""",RC[-2]+SUMIF(testreval!C,'Total Summary'!RC[-4],testreval!C[9]))"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
Range(.[B2:E2, [B2:E2].End(xlDown)]).NumberFormat = "#,##0.00_ ;[Red]-#,##0.00 "
End With
'...
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]="""","""",IF(RC[-4]=0,0,RC[-4]/RC[-1]))"
Range("F2").Select
Selection.Copy
Range("F3:F100").Select
ActiveSheet.Paste
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "#,##0.00_ ;[Red]-#,##0.00 "
'...
'...
'...
End Sub