What is the best way to convert a range of cells to a string? I have a function that only takes a string as input so I need to convert the range to a string, while retaining
you could use this function:
Function Rang2String(rng As Range) As String
Dim strng As String
Dim myRow As Range
With rng
For Each myRow In .Rows
strng = strng & Join(Application.Transpose(Application.Transpose(myRow.value)), "|") & vbLf
Next
End With
Rang2String = Left(strng, Len(strng) - 1)
End Function
which would return a string with linefeed character as range rows separator and pipes ("|") as columns separator