Hello,
I have a basic VBA code that populates formulas in column D based on the value in column C (it's converting time zones, and needs to account for daylight savings). The problem is the code needs to run for a huge number of cells (~1 million records) and it is currently prohibitively slow. I'm sure there's another way to rewrite the code to run more efficiently. Any ideas?
Here is the current code:
I have a basic VBA code that populates formulas in column D based on the value in column C (it's converting time zones, and needs to account for daylight savings). The problem is the code needs to run for a huge number of cells (~1 million records) and it is currently prohibitively slow. I'm sure there's another way to rewrite the code to run more efficiently. Any ideas?
Here is the current code:
VBA Code:
last_row = ActiveSheet.UsedRange.Rows.Count
For i = 2 To last_row
If Cells(i, 3).Value < "43534.33" Then
Cells(i, 4).FormulaR1C1 = "=RC[-1]-(6/24)"
ElseIf Cells(i, 3).Value < "43772.29" Then
Cells(i, 4).FormulaR1C1 = "=RC[-1]-(5/24)"
Else
Cells(i, 4).FormulaR1C1 = "=RC[-1]-(6/24)"
End If
Next i