View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default How can I loop through all Formula in a workbook?

Hi Dave,

I'd add one more line:


So would I!

Thank you!


---
Regards,
Norman



"Dave Peterson" wrote in message
...
I'd add one more line:

Set rng = nothing '<-- added
On Error Resume Next
Set rng = SH.Cells.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0

If there are no formulas on a worksheet, then rng won't change. And
depending
on what's going to happen to those cells with formulas, it could be a
problem.

And to the OP, Norman showed how to get a range with all the formulas. If
you're doing something like changing the fill color, you can do it all at
once--you don't need to loop through those cells.