Is there any way to enumerate the cell which contain a formula?

  • Thread starter Thread starter Aaron Queenan
  • Start date Start date
A

Aaron Queenan

I want to search all of the cells which contain a formula, and preferably
not bother with the empty cells. Is there any way to get that information
from the Excel 2000 object model?

Thanks,
Aaron Queenan.
 
Aaron,

You can use the SpecialCells property to get a range of cells
with formulas. For example,

Dim FRng As Range
Dim R As Range
On Error Resume Next
Set FRng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
On Error GoTo 0
If Not FRng Is Nothing Then
For Each R In FRng
Debug.Print R.Address, R.Formula
Next R
Else
Debug.Print "No cells with formulas."
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top