I have the following macro. Everything is ok with it, I just need to leave empty cell if there is no output (no values/numbers). Is it possible to do this? Can I get some help, please? Thanks.
In the current code, if there is an output in the cell (eg 6), thats ok. but if there is no output, then I see a visibly blank cell with udf formula in it. but since it's not empty, my other formulas depending on this output doesn't give results correctly.
In the current code, if there is an output in the cell (eg 6), thats ok. but if there is no output, then I see a visibly blank cell with udf formula in it. but since it's not empty, my other formulas depending on this output doesn't give results correctly.
Code:
Option Explicit
Function MFx(r As Range, s As String, Optional delimiter As String = ",") As String
Dim c As Range
Dim result As String
For Each c In r
If InStr(delimiter & s & delimiter, delimiter & c & delimiter) <> 0 Then result = result & c & delimiter
Next c
If Len(result) > 0 Then result = Left(result, Len(result) - Len(delimiter))
MFx = result
End Function
Last edited: