ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to test if a cell is empty in a custom function? (https://www.excelbanter.com/excel-programming/393235-how-test-if-cell-empty-custom-function.html)

BingBong

How to test if a cell is empty in a custom function?
 
Hi,

I'm somewhat new to Excel VBA so pardon me if this question is
simplistic

I am writing a custom function in Excel 07 that performs a calculation
based on 4 input cells in the worksheet and returns one value. I want
this function to return a null value (or a "" vlaue) if one of the
input cells is empty.

Now this would be easy using ISEMPTY using an equation but how do I do
something similar in a VBA custom function? I can't get this to work.

I would think that I have to pass a range to ISEMPTY in a custom
function but don't know how to do that in VBA.

I'm stuck. Can anyone help me here?

Thanks,

BB

Wigi

How to test if a cell is empty in a custom function?
 
Hi

eg.

If Len(Range("A1").Value) = 0 then msgbox "it's empty"



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"BingBong" wrote:

Hi,

I'm somewhat new to Excel VBA so pardon me if this question is
simplistic

I am writing a custom function in Excel 07 that performs a calculation
based on 4 input cells in the worksheet and returns one value. I want
this function to return a null value (or a "" vlaue) if one of the
input cells is empty.

Now this would be easy using ISEMPTY using an equation but how do I do
something similar in a VBA custom function? I can't get this to work.

I would think that I have to pass a range to ISEMPTY in a custom
function but don't know how to do that in VBA.

I'm stuck. Can anyone help me here?

Thanks,

BB


joel

How to test if a cell is empty in a custom function?
 
Function testempty(target As Range)

testempty = IsEmpty(target)

End Function


"BingBong" wrote:

Hi,

I'm somewhat new to Excel VBA so pardon me if this question is
simplistic

I am writing a custom function in Excel 07 that performs a calculation
based on 4 input cells in the worksheet and returns one value. I want
this function to return a null value (or a "" vlaue) if one of the
input cells is empty.

Now this would be easy using ISEMPTY using an equation but how do I do
something similar in a VBA custom function? I can't get this to work.

I would think that I have to pass a range to ISEMPTY in a custom
function but don't know how to do that in VBA.

I'm stuck. Can anyone help me here?

Thanks,

BB



All times are GMT +1. The time now is 05:18 PM.

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