ExperTeece
New Member
- Joined
- Sep 19, 2012
- Messages
- 6
I have created a custom function do perform concatenation of 16 cells that may not all have values in them. The first cell is required so I pass its value seperately. The remainder I pass as a range. The function works fine during testing but then once I save the file and reopen it the function ends up with the #VALUE! error. I have somewhat resolved the issue by putting a default value in the first cell rather than leaving it blank but would really like to figure out why the function is not working. Thanks in advance for any answers you may have. Below is the code:
Code:
Function DescBuild(Optional Class As String, Optional AttRng As Range) As String
Dim FinalString As String
Dim attCnt As Integer
DescBuild = ""
FinalString = ""
'If Class = "" Then
' GoTo MyExit
'End If
FinalString = Class
For attCnt = 1 To 15
If Not AttRng(attCnt).Value = "" Then
FinalString = FinalString & ", " & AttRng(attCnt).Value
End If
Next
MyExit:
DescBuild = FinalString
End Function