Option Explicit
Function 三欄合併以字符連接並對齊(X As String, Y As String, Z As Range, Area As Range)
'↑自訂函數:三欄合併以字符連接並對齊(第一個連接字符,第二個連接字符,連接儲存格,對齊參照儲存格)
Dim Arr, i&, j&, S&, A&(2), B$(2), T As Boolean
Arr = Area
Head:
S = IIf(T, 1, 2)
For i = 1 To S
For j = 1 To UBound(Arr)
If Arr(j, 1) = "" Then Exit For
If T Then
B(1) = Arr(j, 1) & Application.Rept(" ", A(1) - Len(Arr(j, 1)))
B(2) = Arr(j, 2) & Application.Rept(" ", A(2) - Len(Arr(j, 2)))
Arr(j, i) = B(1) & "+" & B(2) & " " & Arr(j, 3)
ElseIf A(i) < Len(Arr(j, i)) Then
A(i) = Len(Arr(j, i))
End If
Next
Next
If T = False Then T = True: GoTo Head
三欄合併以字符連接並對齊 = Arr(Z.Row, 1)
Set Arr = Nothing
Erase A, B
End Function