CHRIS RAE'S VBA PAGES
Routine: | CommaDelimited |
Parameters: | inarr As Variant, Optional delim As String = "," |
Description: | Return an array as a comma-delimited string. Should work with most types. |
Function CommaDelimited(inarr As Variant, Optional delim As String = ",") As String
' Chris Rae's VBA Code Archive - http://chrisrae.com/vba
' Code written 8/4/00, 13/7/00 by Chris Rae
Dim outp As String
Dim thruarr As Integer
For thruarr = LBound(inarr) To UBound(inarr)
outp = outp & CStr(inarr(thruarr)) & IIf(thruarr < UBound(inarr), delim, "")
Next thruarr
CommaDelimited = outp
End Function
You're free to use these routines for anything you want - all I ask is that for commercial use you give me credit somewhere. You may instead want to head back to the index for my Visual Basic for Applications Pages or the main routines archive page.