View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Lars Uffmann Lars Uffmann is offline
external usenet poster
 
Posts: 35
Default using a formula for a column vs. looping over each row - speeddifference?

Lars Uffmann wrote:
Let's see how it fares vs. my loop when I need to
calculate more fields per row :)


Hmm - still Excel optimisation wins. Is there a way to directly
calculate results into a destination column, without putting the formula
there?

Like to change this:
' Method 1
oldWs.Range("B2:B" & lastRow).Formula = "If (RC[-1]=""yes"", 1, 0)"
newWs.Columns(1).Value = oldWs.Columns(1).Value


into something like this?:
newWs.Columns(1).Value = _
ExcelFormulaCalculation ("If (RC[1]=""yes"", 1, 0)"


Best Regards,

Lars