How to write UDF
in Visual Basic for Applications that can work with structured references like this:
=UDF([Colomn1])
or this:
=UDF(if(len([Colomn1])>1,[Colomn1]))
Any ideas?
@Rory, this function work with range, but not work with reference to column. Result values are repeated.
Function udff(sRange As Range) As Variant
Dim valueArr As Variant
valueArr = sRange.Value
ReDim resArr(LBound(valueArr, 1) To UBound(valueArr, 1), LBound(valueArr, 2) To UBound(valueArr, 2))
For i = LBound(valueArr, 1) To UBound(valueArr, 1)
For j = LBound(valueArr, 2) To UBound(valueArr, 2)
resArr(i, j) = valueArr(i, j) & "!"
Next j
Next i
udff = resArr
End Function