I’m trying to create a function that searches a range of cells,
and returns cells with text as a CSV string.
Blockquote
Function SearchAndReturnCSV(oRange As Range) As String
’ Declare variables
Dim oCell As Range
Dim sCSV As String
' Loop through each cell in the range
For Each oCell In oRange
' If the cell has text, add it to the CSV string
If Len(oCell.Text) > 0 Then
sCSV = sCSV & oCell.Text & ","
End If
Next
' Return the CSV string
SearchAndReturnCSV = sCSV
End Function
Blockquote
any help will be appreciated.