arash
03-12-2009, 10:23 AM
Hi guys,
I have a problem when I want to check if there is an empty cell in a selection. I have some codes (below). I would greatly appreciate if someone could tell me the reason behind the errors (and hopefully the solution!).
My first try:
msgbox Worksheets(1).countblank(Range(Cells(2, 4), Cells(2, 8)))
Error: Object does not support this property or method.
I don't understand the error since if you check excel help for countblank you get:
expression.CountBlank(Arg1) where Arg1 is a range and it return value is double.
My second try:
If worksheets(1).Range("A2") Is Empty Then GoTo InvalidValue
Error 424: Object required
Excel error messages really sucks!
When I replace Empty with Nothing, it works (no errors) but does not recognise the empty cells.
If I replace it with "" then I get type mismatch error.
Cheers,
/Arash
I have a problem when I want to check if there is an empty cell in a selection. I have some codes (below). I would greatly appreciate if someone could tell me the reason behind the errors (and hopefully the solution!).
My first try:
msgbox Worksheets(1).countblank(Range(Cells(2, 4), Cells(2, 8)))
Error: Object does not support this property or method.
I don't understand the error since if you check excel help for countblank you get:
expression.CountBlank(Arg1) where Arg1 is a range and it return value is double.
My second try:
If worksheets(1).Range("A2") Is Empty Then GoTo InvalidValue
Error 424: Object required
Excel error messages really sucks!
When I replace Empty with Nothing, it works (no errors) but does not recognise the empty cells.
If I replace it with "" then I get type mismatch error.
Cheers,
/Arash