View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jules Jules is offline
external usenet poster
 
Posts: 86
Default Do not calculate or update formula's during macro

My hero! Awesome. Thanks!!

"Gary''s Student" wrote:

I had a similar problem. First freeze the formulas and then un-freeze them.

So first call:

Sub freezeUm()
q = Chr(39)
eq = "="
For Each r In ActiveSheet.UsedRange
If r.HasFormula Then
r.Value = q & r.Formula
End If
Next
End Sub

and after you do your thing, call:

Sub unfreezeUm()
eq = "="
For Each r In ActiveSheet.UsedRange
If Not r.HasFormula And Left(r.Value, 1) = eq Then
r.Formula = r.Value
End If
Next
End Sub

--
Gary''s Student - gsnu201001


"Jules" wrote:

Is there so code to keep formulas in a spreadsheet from updating? I have a
macro that changes sheet names and location of some data but I do not want
the formulas referring to those sheets to update.

In other words, my formula may read ='Section 2'!A2-'Section 3'!A2

Part of my macro is to rename my sheets so 'Section 3" becomes "Section 2"
and "Section 2" becomes "Section 1".

After my macro, the formula ends up reading ='Section 1'!A2-'Section 2'!A2

I want to avoid that happening. I don't want my formula to know that my
sheets renamed.

Any suggestions?

Thanks!
Jules