Thread
:
UDF help
View Single Post
#
12
Posted to microsoft.public.excel.programming
Sandy Mann
external usenet poster
Posts: 2,345
UDF help
You're very welcome.
--
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
Replace @mailinator.com with @tiscali.co.uk
"John C" <johnc@stateofdenial wrote in message
...
Thank you very much.
--
John C
"Sandy Mann" wrote:
Try something like:
Function NullCell(rng As Range) As Variant
If rng.Value = "" Then
NullCell = ""
Exit Function
End If
NullCell = rng.Value
End Function
--
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
Replace @mailinator.com with @tiscali.co.uk
"John C" <johnc@stateofdenial wrote in message
...
Not quite as simple as that. I wish it were.
If A1 is either blank or empty, I want the cell where the NullCell
function
is to appear empty.
If A1 is blank due to formula (i.e.: =""), then the NullCell function
works,
but if there is NO data in there, I get an answer of 0.
--
John C
"Bob Phillips" wrote:
It is quite simple.
The value is returned as the function name
Function NullCell()
'some code
NullCell = somevalue
End Function
If you want to pass a value into the function you just declare an
argument
Function NullCell(ByRef rng As Range)
'do something to rng
NullCell = somevalue
End Function
--
__________________________________
HTH
Bob
"John C" <johnc@stateofdenial wrote in message
...
What are some good references on creating UDF's?
While my real need is far more complex than I list here, I will give
a
basic
basic situation.
A2: =IF(A1="","",A1)
I would prefer something more like
A2: =NullCell(A1)
Thank you.
--
John C
Reply With Quote
Sandy Mann
View Public Profile
Find all posts by Sandy Mann