I have a special function that is called from within a spreadsheet cell, and I want to not return anything in some cases. In other words, I want the cell with my function to be treated exactly like an empty cell (if the function does not return a value).
The closest I can do is return the empty string "" . Unfortunately, a cell with a zero string of length is not processed as COUNTA or COUNTBLANK and breaks up mathematical formulas (for example, 1 + "" = #VALUE ).
Most of my attempts to return nothing result in a return of 0, but the user will interpret it differently.
What should I do?
Tried so far:
Returns 0: result = null result = VbEmpty result = Range("SomeCellKnownToBeEmpty") Returns error: result = Nothing
Answer: Now I am sure that this is impossible, and the best that can be done is to get around this.
Work with the parameters:
- It returns the string
"-blank-" and the VBA macro deletes the contents of any cell using "-blank-" . Strange approach, but suitable for my needs. I do this as one of the steps in preparing my book for publication. - Return an empty string and explicitly get other formulas on the worksheet to treat
"" as blank. - Return and display 0: return 0 and use special formatting to hide 0.
WoodenKitty
source share