I am using Excel 2010 and 2013.
I have a list of names, phone numbers, and addresses in 1 column.
Each cell contains a persons name, Telelphone number, and Home address.
John Doe (xxx) xxx-xxxx yyyy Street Name City Name Postal Code
Currently the list of information is in Column B.
I would like to remake this list upon clicking a Button that would copy the data onto a new sheet with Name under B column, Phone number in a C column, and Address in a D column column.
How can this be done with VBA? I have tried to make a loop but I am a VBA novice and not even sure what I am doing wrong.
Private Sub CommandButton1_Click()
Dim rCell As Range
Dim rRng As Range
Dim Pnumbloc As Integer
Dim PhoneNumb As String
Dim Name As String
Dim Address As String
Set rRng = Sheet1.Range("B1:B600")
For Each rCell In rRng.Cells
Pnumbloc = Search("(", rCell, 1)
Name = Mid(rCell, 1, Pnumb)
PhoneNumb = Mid(rCell, Pnumbloc, 14)
Address = Mid(rCell, Pnumbloc + 14, 45)
MsgBox Name & PhoneNumb & Address
Next rCell
End Sub
I have a list of names, phone numbers, and addresses in 1 column.
Each cell contains a persons name, Telelphone number, and Home address.
John Doe (xxx) xxx-xxxx yyyy Street Name City Name Postal Code
Currently the list of information is in Column B.
I would like to remake this list upon clicking a Button that would copy the data onto a new sheet with Name under B column, Phone number in a C column, and Address in a D column column.
How can this be done with VBA? I have tried to make a loop but I am a VBA novice and not even sure what I am doing wrong.
Private Sub CommandButton1_Click()
Dim rCell As Range
Dim rRng As Range
Dim Pnumbloc As Integer
Dim PhoneNumb As String
Dim Name As String
Dim Address As String
Set rRng = Sheet1.Range("B1:B600")
For Each rCell In rRng.Cells
Pnumbloc = Search("(", rCell, 1)
Name = Mid(rCell, 1, Pnumb)
PhoneNumb = Mid(rCell, Pnumbloc, 14)
Address = Mid(rCell, Pnumbloc + 14, 45)
MsgBox Name & PhoneNumb & Address
Next rCell
End Sub