View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Excel Helps Excel Helps is offline
external usenet poster
 
Posts: 27
Default Modify a UDF please?

Could this be slightly modified please:

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
Dim pipe As Boolean
pipe = True
For Each Cell In CellBlock
pipe = Not pipe

If Len(Cell.Text) 0 Then
If pipe = False Then
sbuf = sbuf & Cell.Text & Chr(166)
Else
sbuf = sbuf & Cell.Text & "|"
End If
End If
Next
ConCatRange = sbuf
End Function

To achieve this
a¦a|b¦b|c¦c
rather than
a¦b|c¦

Thanks Guys