View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Loop not quite working correctly

Try filtering your range on blank cells only in a For Each loop...


Sub FilterOnBlankCells()
Dim OneRng As Range, c As Range, sBlanks$, vMsg
Set OneRng = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
For Each c In OneRng.SpecialCells(xlCellTypeBlanks)
sBlanks = sBlanks & "|" & c.Address
Next 'c

If sBlanks < "" Then
vMsg = "Blanks found on the following cells:" & vbLf & vbLf
vMsg = vMsg & Join(Split(Mid(sBlanks, 2), "|"), vbLf)
Else
vMsg = "No blanks found"
End If
MsgBox vMsg
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion