How would I rewrite this Macro to process faster Sub Macro D

How would I rewrite this Macro to process faster?

Sub Macro()

Dim i As Integer

Dim j As Integer

i = 2

j = 1

For j = 1 To 252

For i = 2 To 1008 -

Cells(i, j + 3).Select

    ActiveCell.Value = (Cells(i, 3).Value - Cells(i + j, 3).Value) / Cells(i + j, 3).Value

    Selection.NumberFormat = \"0.00%\"

    Next i

    Next j

End Sub

  

Solution

Sub Macro()
Dim i As Integer:Dim j As Integer
i = 2:j = 1
For j = 1 To 252
For i = 2 To 1008
Cells(i, j + 3).Select
ActiveCell.Value = (Cells(i, 3).Value - Cells(i + j, 3).Value) / Cells(i + j, 3).Value
Selection.NumberFormat = \"0.00%\"
Next i:Next j
End Sub

1.Club different lines into single lines which can be placed in single line.

2. Get constant value variables out of for loop.

How would I rewrite this Macro to process faster? Sub Macro() Dim i As Integer Dim j As Integer i = 2 j = 1 For j = 1 To 252 For i = 2 To 1008 - Cells(i, j + 3)

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site