sdfjh87687
New Member
Please help me modify this:
To able enter third optional omitting parameter.
I would like to omit cells with FALSE value. But I don't know whether to set in as FALSE or "FALSE". Is it excel's keyword ? (no string "string") Also does makes difference when I manually type into cell FALSE, and when formula makes it ?
I read CONCATENATE function has limit to operate with max string length at 255 signs.
If I use operator &, it has no limit. Please tell me, which thing use Chandoo's macro ?
Thanks for help
//edit:
I was googling meanwhile and found these 2 code lines:
If cell.Value = "FALSE" Then
cell.Ignore
Look how I put inside, but it didn't work, didn't crash either.
Code:
Function concat(useThis As Range, Optional delim As String) As String
' this function will concatenate a range of cells and return one string
' useful when you have a rather large range of cells that you need to add up
Dim retVal, dlm As String
retVal = ""
If delim = Null Then
dlm = ""
Else
dlm = delim
End If
For Each cell In useThis
If CStr(cell.Value) <> "" And CStr(cell.Value) <> " " Then
retVal = retVal & CStr(cell.Value) & dlm
End If
Next
If dlm <> "" Then
retVal = Left(retVal, Len(retVal) - Len(dlm))
End If
concat = retVal
End Function
I would like to omit cells with FALSE value. But I don't know whether to set in as FALSE or "FALSE". Is it excel's keyword ? (no string "string") Also does makes difference when I manually type into cell FALSE, and when formula makes it ?
I read CONCATENATE function has limit to operate with max string length at 255 signs.
If I use operator &, it has no limit. Please tell me, which thing use Chandoo's macro ?
Thanks for help
//edit:
I was googling meanwhile and found these 2 code lines:
If cell.Value = "FALSE" Then
cell.Ignore
Look how I put inside, but it didn't work, didn't crash either.
Code:
Function concat(useThis As Range, Optional delim As String) As String
' this function will concatenate a range of cells and return one string
' useful when you have a rather large range of cells that you need to add up
Dim retVal, dlm As String
retVal = ""
If delim = Null Then
dlm = ""
Else
dlm = delim
End If
For Each cell In useThis
If cell.Value = "FALSE" Then
cell.Ignore
If CStr(cell.Value) <> "" And CStr(cell.Value) <> " " Then
retVal = retVal & CStr(cell.Value) & dlm
End If
Next
If dlm <> "" Then
retVal = Left(retVal, Len(retVal) - Len(dlm))
End If
concat = retVal
End Function
Last edited: