Remove #VALUE! from ConCat Range Function

E

Excel Helps

How do I remove the #VALUE! from my output file when running the function
below.
Some cells in my input file have no data, and I need the output file to
reflect this rather than displaying a #VALUE! error.

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 & Chr(166)
sbuf = sbuf & Cell.Text & "|"

End If
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)

End Function
 
E

Excel Helps

Thanks Ron
But I can't fathom out what I need to remove the #VALUE! error from your link.
I'm hoping that Roger may pick up this thread as he forwarded me the piece
of code which works fine for my needs apart from the #VALUE! error.
My limited experience with VB code is not sufficient to alter the code.
 
R

Ron de Bruin

There are no errors when you use the function from J.E when there are empty cells in the range
 
R

Ron de Bruin

Sorry I not read it good
Roger posted a suggestion for you in the Excel user group
 
E

Excel Helps

Thanks,
I'll take a look.
Your link to your site is very interesting for other Excel Stuff!
Thanks
 

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.

Ask a Question

Similar Threads


Top