ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test For BLANK Range (https://www.excelbanter.com/excel-programming/396903-test-blank-range.html)

RayportingMonkey

Test For BLANK Range
 
I need to write an IFTHENELSE statement that will look at a range to
determine if it is blank or not. If it is blank I need to throw a messagebox.
If not, I need to continue.

My problem is that I can see how to do this with a formula in a sheet, but
don't want the results (or the formula for that matter) to appear on my
worksheet.

Any help is appreciated!

Thanks,
Ray

Gary''s Student

Test For BLANK Range
 
It depends on "how" blank:

Sub blanket()
MsgBox (Application.WorksheetFunction.CountA(Selection))
End Sub

will return zero if the cells Selected are empty. It will return 1 if one
of the cells contains something like:
=""
--
Gary''s Student - gsnu200742


"RayportingMonkey" wrote:

I need to write an IFTHENELSE statement that will look at a range to
determine if it is blank or not. If it is blank I need to throw a messagebox.
If not, I need to continue.

My problem is that I can see how to do this with a formula in a sheet, but
don't want the results (or the formula for that matter) to appear on my
worksheet.

Any help is appreciated!

Thanks,
Ray


RayportingMonkey

Test For BLANK Range
 
Actually, it seems to return a 1 no matter what...

"Gary''s Student" wrote:

It depends on "how" blank:

Sub blanket()
MsgBox (Application.WorksheetFunction.CountA(Selection))
End Sub

will return zero if the cells Selected are empty. It will return 1 if one
of the cells contains something like:
=""
--
Gary''s Student - gsnu200742


"RayportingMonkey" wrote:

I need to write an IFTHENELSE statement that will look at a range to
determine if it is blank or not. If it is blank I need to throw a messagebox.
If not, I need to continue.

My problem is that I can see how to do this with a formula in a sheet, but
don't want the results (or the formula for that matter) to appear on my
worksheet.

Any help is appreciated!

Thanks,
Ray


Gary''s Student

Test For BLANK Range
 
Try it on a fresh blank worksheet. It should give 0 for any Select'ed block
of cells
--
Gary''s Student - gsnu200742


"RayportingMonkey" wrote:

Actually, it seems to return a 1 no matter what...

"Gary''s Student" wrote:

It depends on "how" blank:

Sub blanket()
MsgBox (Application.WorksheetFunction.CountA(Selection))
End Sub

will return zero if the cells Selected are empty. It will return 1 if one
of the cells contains something like:
=""
--
Gary''s Student - gsnu200742


"RayportingMonkey" wrote:

I need to write an IFTHENELSE statement that will look at a range to
determine if it is blank or not. If it is blank I need to throw a messagebox.
If not, I need to continue.

My problem is that I can see how to do this with a formula in a sheet, but
don't want the results (or the formula for that matter) to appear on my
worksheet.

Any help is appreciated!

Thanks,
Ray



All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com