指定セル範囲の文字列連結関数
指定されたセル範囲の文字列を連結する関数です。
Public Function U_StrCat(セル範囲 As range) As String Dim result As String Dim cell As range result = "" For Each cell In セル範囲 result = result & cell.Value Next U_StrCat = result End Function
2008/12/11 セル範囲を複数指定できるように拡張した関数も考えました。
Public Function U_StrCat(ParamArray セル範囲配列() As Variant) As String Dim result As String Dim cellRange As Variant Dim cell As Range result = "" For Each cellRange In セル範囲配列 For Each cell In cellRange result = result & cell.Value Next Next U_StrCat = result End Function