Ciprian Banisor
Ciprian Banisor

Reputation: 3

VBA function call from excel

I am creating a function to concatenate all cells in a range in a single cell. Everything works ok with the function.

Function transposerange(Rg As Range)
    Dim xCell As Range
    Dim xStr As String
    For Each xCell In Rg
        If Not IsEmpty(xCell.Value) Then
            xStr = xStr & xCell.Value & " "
        End If
    Next
    transposerange = Left(xStr, Len(xStr) - 1)
End Function

If I save it in the opened workbook, I can call it from excel. If I save this function to my personal workbook, it doesn't appear in excel when I want to call it.

What am I doing wrong?

Upvotes: 0

Views: 299

Answers (1)

MarcinSzaleniec
MarcinSzaleniec

Reputation: 2256

If you want use this function in your spreadsheets, type Personal.xlsb!transposerange(somerange). If you want just transposerange you must make add-id comprising this UDF.

Upvotes: 1

Related Questions