View Single Post
  #5   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

New and improved version...

Sub FilterOnBlankCells()
Dim OneRng As Range, c As Range, sBlanks$, vMsg

Set OneRng = Range("N1:N" & Cells(Rows.Count, "N").End(xlUp).Row)
On Error GoTo ErrExit

For Each c In OneRng.SpecialCells(xlCellTypeBlanks)
sBlanks = sBlanks & "|" & c.Address
Next 'c

ErrExit:
If Err = 0 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, vbInformation
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