I'm writing a quick 'n dirty workbook analyzer that flags potential design weaknesses (beyond what the built-in Formula Auditing tools provide).
One of the things I want to do is loop through the formulas on a worksheet (I'm just using .SpecialCells(xlCellTypeFormulas)) to look for formulas that contain constants. For example, I'm not interested in formulas like:
=$A$1 + $B$1
but I AM interested in formulas like:
=$A$1 + 10
=Sum(A1:A10) * .25
because of the constants (in bold) they contain.
Any thoughts on how I could spot these? My initial thought was to pass the .Formula string for each cell to a Subroutine which would parse the string into segments based on any combination of adjacent spaces, parentheses or commas, then checking each segment with IsNumeric. But that seems clunky and would probably be painfully slow for the large workbooks I have to analyze (some containing over a million formulas!) - is there a more clever way to spot formulas that contain constant values? And if not, how can I make that parsing routine as efficient and comprehensive as possible?
Thanks!
VBAjedi
One of the things I want to do is loop through the formulas on a worksheet (I'm just using .SpecialCells(xlCellTypeFormulas)) to look for formulas that contain constants. For example, I'm not interested in formulas like:
=$A$1 + $B$1
but I AM interested in formulas like:
=$A$1 + 10
=Sum(A1:A10) * .25
because of the constants (in bold) they contain.
Any thoughts on how I could spot these? My initial thought was to pass the .Formula string for each cell to a Subroutine which would parse the string into segments based on any combination of adjacent spaces, parentheses or commas, then checking each segment with IsNumeric. But that seems clunky and would probably be painfully slow for the large workbooks I have to analyze (some containing over a million formulas!) - is there a more clever way to spot formulas that contain constant values? And if not, how can I make that parsing routine as efficient and comprehensive as possible?
Thanks!
VBAjedi