View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Check for References to Blank Cells

assume the cell is Cell F10. as long as the formula only references cells
on the same sheet

Dim rng as Range, rng1 as Range
set rng = Range("F10").DirectPrecedents
on Error Resume Next
set rng1 = rng.specialCells(xlBlanks)
On Error goto 0
if not rng1 is nothing then
msgBox rng1.Address & " are blank"
End if

--
Regards,
Tom Ogilvy


"ExcelMonkey" wrote in message
...
I want to use VBA to check to see if a formulas has any references to

blank
cells.

So if my formulas is

=A1+SUM(B2:B30)/Average(C1:C30)+Opcost

I want to know if either A1 is blank, any of the array items in the SUM or
Average are blank, if named cell Opcost is blank etc

Is there a way to evaluate the formula propertly of the cell object to

test
for blanks? Am I wandering into Regular Expression territory with this

one?
Or can I do it with VBA?

Thanks