I have some vba code in excel which runs on the Worksheet_Change event after an update to the worksheet every 200ms
The refresh rate after running existing code averages approx 210ms however when I add this code to compare two ranges the average refresh rate inreases to approx 400ms
What is the absolute optimum way of speeding up my code to compare cells in 2 ranges and update upon conditions. My current code which slows this down to 400ms is
i want to compare cell h5 to ay5 and if h5 is lower set ay5 to h5 then repeat for h6 and ay6 etc
Many thanks
Os
The refresh rate after running existing code averages approx 210ms however when I add this code to compare two ranges the average refresh rate inreases to approx 400ms
What is the absolute optimum way of speeding up my code to compare cells in 2 ranges and update upon conditions. My current code which slows this down to 400ms is
Code:
Application.EnableEvents = False
Application.ScreenUpdating = False
CurrentPRICE = Range("h5:h55")
Set LowestPRICE = Range("ay5")
r1 = 0
For Each c1 In CurrentPRICE
If c1 < LowestPRICE.Offset(r1, 0).Value Or LowestPRICE.Offset(r1, 0).Value = "" Then
LowestPRICE.Offset(r1, 0) = c1
End If
r1 = r1 + 1
Next c1
Application.ScreenUpdating = True
Application.EnableEvents = True
i want to compare cell h5 to ay5 and if h5 is lower set ay5 to h5 then repeat for h6 and ay6 etc
Many thanks
Os