Eu não sou tão bom em VBA, mas esse código pode fazer isso:
Option Explicit
Public Sub AlignCustNbr()
Dim ws As Worksheet
Dim i As Long
Application.ScreenUpdating = False
Set ws = ActiveSheet
For i = 2 To ws.Columns.Count
If (Trim(ws.Cells(1, i).Value & "") = "") Then
Exit For
End If
'
Call Align2Columns(ws, 1, i)
Next i
End Sub
Private Sub Align2Columns(ws As Worksheet, mainCol As Long, dataCol As Long)
Dim colData() As String
Dim strTemp As String, strTemp2 As String
Dim i As Long, j As Long
Dim lastDataRow As Integer
ReDim colData(1 To ws.Rows.Count)
lastDataRow = 1
'
'Findeing aligned datas to colData()
For i = 1 To ws.Rows.Count
strTemp = Trim(ws.Cells(i, dataCol).Value & "")
If (strTemp = "") Then
Exit For
End If
'
For j = 1 To ws.Rows.Count
strTemp2 = Trim(ws.Cells(j, mainCol).Value & "")
If (strTemp2 = "") Then
lastDataRow = lastDataRow + 1
colData(j + lastDataRow) = strTemp2
Exit For
' to avoid cese sensetive use commented line
'ElseIf (UCase(strTemp) = UCase(strTemp2)) Then
ElseIf (strTemp = strTemp2) Then
colData(j) = strTemp2
Exit For
End If
Next j
Next i
'
'Update dataCol
i = 0
Do
i = i + 1
ws.Cells(i, dataCol).Value = colData(i)
If (Trim(ws.Cells(i, mainCol).Value & "") = "") Then
lastDataRow = lastDataRow - 1
End If
Loop While lastDataRow > 0
End Sub