Give this one a shot...
Sub nameSort()
Dim i As Long
Dim LastRow As Long
Dim NextRow As Long
Dim Name As String
Dim FSpace As String
Dim ws As Worksheet
Application.ScreenUpdating = False
Set ws = Sheets("Contact info") 'Set Destination Worksheet
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow
If InStr(1, Cells(i, "A").Value, "@") > 1 Then 'Identify email address
NextRow = ws.Cells(Rows.Count, "C").End(xlUp).Row + 1 'find next empty destination row
Name = Cells(i - 1, "A").Value
FSpace = InStr(1, Name, " ")
ws.Cells(NextRow, "B").Value = Left(Name, FSpace - 1) 'first name
ws.Cells(NextRow, "C").Value = Mid(Name, FSpace + 1) 'last name
ws.Cells(NextRow, "D").Value = Cells(i, "A").Value 'email
ws.Cells(NextRow, "E").Value = Cells(i + 1, "A").Value 'phone
If IsNumeric(Left(Cells(i + 2, "A").Value, 1)) Then 'If there is a second phone #
ws.Cells(NextRow, "F").Value = Cells(i + 3, "A").Value
ws.Cells(NextRow, "G").Value = Cells(i + 4, "A").Value
ws.Cells(NextRow, "H").Value = Cells(i + 6, "A").Value & ", " & Cells(i + 7, "A").Value
Else 'If there's only one phone #
ws.Cells(NextRow, "F").Value = Cells(i + 2, "A").Value
ws.Cells(NextRow, "G").Value = Cells(i + 3, "A").Value
ws.Cells(NextRow, "H").Value = Cells(i + 5, "A").Value & ", " & Cells(i + 6, "A").Value
End If
End If
Next i
Application.ScreenUpdating = True
End Sub
Bookmarks