ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there any way to enumerate the cell which contain a formula? (https://www.excelbanter.com/excel-programming/291190-there-any-way-enumerate-cell-contain-formula.html)

Aaron Queenan

Is there any way to enumerate the cell which contain a formula?
 
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.



Chip Pearson

Is there any way to enumerate the cell which contain a formula?
 
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(xlCellTypeFormu las)
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

"Aaron Queenan" wrote
in message ...
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.






All times are GMT +1. The time now is 04:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com