xlCellTypeBlanks
Another way:
Dim myRng as range
on error resume next
set myrng = Selection.SpecialCells(xlCellTypeBlanks)
on error goto 0
if myrng is nothing then
msgbox "0 blank cells found"
else
msgbox myrng.cells.count
myrng.select 'do you really want to select the cell
end if
====
If the selection could be a single cell, I'd use:
set myrng = intersect(selection, selection.cells.specialcells(xlcelltypeblanks))
actually, I'd use this all the time -- just to be safe.
mark wrote:
sorry... bumped the wrong key.
so like I was saying, I'm trying to select only the blank cells in a
selected range, using this line:
Selection.SpecialCells(xlCellTypeBlanks).Select
But, in situations with a small input set, there are times when there are no
blank cells.
I was hoping I could check:
Selection.SpecialCells(xlCellTypeBlanks).Count
But that doesn't work... it errors out and still says 'No Cells Found",
instead of telling me 0.
I could probably work in an error handler, but is there another way without
that that someone sees, which I'm not thinking of?
Thanks.
"mark" wrote:
Hi.
I'm trying to select only the blank cells in a selected range.
--
Dave Peterson
|