I found the following formula in the worsheet function
section of this group.
=Q2&" " &R2&" "&S2&" "&T2&" "&U2&" "&V2
It works great. Now I would like to refine it a little.
With some entries one or two of the fields are blank. How
do I tell Excel to ignore the field if it is blank? In
other words, don't put a space if this field is blank?
OR User Defined Function copy/pasted to a general module in your workbook.
Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sBuf As String
For Each cell In CellBlock
If Len(cell.text) > 0 Then sBuf = sBuf & cell.text & " "
Next
ConCatRange = Left(sBuf, Len(sBuf) - 1)
End Function
Maybe not totally ridiculous, I just learned that VBA TRIM is different from
Excel TRIM, it just removes leading and trailing spaces.
:=)
Anders
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.