View Full Version : [SOLVED:] Formula to fill down used range
jazz2409
04-25-2020, 08:00 PM
Which calculates faster:
Range("G2").FormulaR1C1 = "=IFERROR(RC[-2]/RC[-1],0)"
With Sheets("comp")
.Range("G2").AutoFill .Range("G2:G" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With
or
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("G2:G" & Lastrow).Formula ="=IFERROR(RC[-2]/RC[-1],0)"
and why?
Thank you!
paulked
04-26-2020, 03:44 AM
You can put in a timer to test it (and any other routines) quite simply:
Sub Whatever()
Dim tm as Double
tm = Timer
'
' Your code
'
Msgbox Timer - tm
End Sub
jazz2409
04-26-2020, 07:09 AM
You can put in a timer to test it (and any other routines) quite simply:
Sub Whatever()
Dim tm as Double
tm = Timer
'
' Your code
'
Msgbox Timer - tm
End Sub
Ooohh so this is what they are doing.. I've seen threads with people saying this ran for x seconds .. Thanks! I'll try now
jazz2409
04-26-2020, 07:56 AM
You can put in a timer to test it (and any other routines) quite simply:
Sub Whatever()
Dim tm as Double
tm = Timer
'
' Your code
'
Msgbox Timer - tm
End Sub
based on this, the second one works faster. Thank you! :)
paulked
04-26-2020, 08:03 AM
You're welcome :thumb
It's a handy thing to use when testing :yes
jazz2409
04-26-2020, 01:40 PM
I actually included it in my project so I can check its performance anytime. Thank you. :bow:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.