test for formula result

R

rbekka33

hi,

I have the below macro which is almost there.

I need to stop the loop when the immediate cell above no longe
displays the result of the formula. I don't know how to test for thi
criteria.

thanks

Sub test()
Do
If IsEmpty(ActiveCell) Then
Selection.FormulaArray = _

"=IF(ROW()-ROW(NoBlanksRange)+1>ROWS(BlanksRange)-COUNTBLANK(BlanksRange),"""",INDIRECT(ADDRESS(SMALL((IF(BlanksRange<>"""",ROW(BlanksRange),ROW()+ROWS(BlanksRange))),ROW()-ROW(NoBlanksRange)+1),COLUMN(BlanksRange),4)))"
If ActiveCell.Offset(-2, 0).Value = "" An
ActiveCell.Offset(-1, 0).Value = "" Then Exit Sub
End If
ActiveCell.Offset(1, 0).Select

Loop Until IsNull(ActiveCell.Offset(-1, 0))



End Su
 
T

Tom Ogilvy

Possibly

Sub test()
Do
If IsEmpty(ActiveCell) Then
Selection.FormulaArray = _

"=IF(ROW()-ROW(NoBlanksRange)+1>ROWS(BlanksRange)-COUNTBLANK(BlanksRange),""
"",INDIRECT(ADDRESS(SMALL((IF(BlanksRange<>"""",ROW(BlanksRange),ROW()+ROWS(
BlanksRange))),ROW()-ROW(NoBlanksRange)+1),COLUMN(BlanksRange),4)))"
End If
ActiveCell.Offset(1, 0).Select

Loop Until ActiveCell.Offset(-1, 0) = ""




rbekka33 > said:
hi,

I have the below macro which is almost there.

I need to stop the loop when the immediate cell above no longer
displays the result of the formula. I don't know how to test for this
criteria.

thanks

Sub test()
Do
If IsEmpty(ActiveCell) Then
Selection.FormulaArray = _
"=IF(ROW()-ROW(NoBlanksRange)+1>ROWS(BlanksRange)-COUNTBLANK(BlanksRange),""
 

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

Top