Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta
    • Thread Starter
    Offline

    1
    ReputationRep:
    Anyone out there willing to help?? Thank you so much !
    Offline

    1
    ReputationRep:
    (Original post by souhm)
    Anyone out there willing to help?? Thank you so much !
    what do you need help in?. like to do what on VBA
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by Romulus Augustus)
    what do you need help in?. like to do what on VBA
    Hi I need help with separating names and surnames into different columns using either "for" or "do" loops. Any idea of how the code will look like ?
    Offline

    16
    ReputationRep:
    Haven't done any for 7 years now, what do you need to do?

    EDIT: I see.
    Offline

    1
    ReputationRep:
    (Original post by souhm)
    Hi I need help with separating names and surnames into different columns using either "for" or "do" loops. Any idea of how the code will look like ?
    No I don't know how to do that. sorry.
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by A Mysterious Lord)
    Haven't done any for 7 years now, what do you need to do?

    EDIT: I see.
    Hi I need help with separating names and surnames into different columns using either "for" or "do" loops. Any idea of how the code will look like ?
    Offline

    16
    ReputationRep:
    (Original post by souhm)
    Hi I need help with separating names and surnames into different columns using either "for" or "do" loops. Any idea of how the code will look like ?
    Where is the data, is it currently in a column of its own?
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by A Mysterious Lord)
    Where is the data, is it currently in a column of its own?
    i have a column from a1 to a200 with names and surnames. I need to separate these in to the next column. It must be in a loop (either for or do loop) . I have some codes but it doesnt work.
    Offline

    16
    ReputationRep:
    (Original post by souhm)
    i have a column from a1 to a200 with names and surnames. I need to separate these in to the next column. It must be in a loop (either for or do loop) . I have some codes but it doesnt work.
    Does this *have* to be done in VBA? You can do this with Excel's own tools.
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by A Mysterious Lord)
    Does this *have* to be done in VBA? You can do this with Excel's own tools.
    Yeah I have to use VBA..


    Posted from TSR Mobile
    Offline

    16
    ReputationRep:
    (Original post by souhm)
    Yeah I have to use VBA..


    Posted from TSR Mobile
    Give me 15 minutes.
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by A Mysterious Lord)
    Give me 15 minutes.
    cool
    Offline

    16
    ReputationRep:
    Still got it

    Code:
    Sub TestMacro()
    Dim sh As Worksheet
    Set sh = ThisWorkbook.Sheets("Sheet1")
    
    Dim k As Long
    Dim str1() As String
    Dim str2() As String
    Dim i As Integer
    k = sh.Range("A1", sh.Range("A1").End(xlDown)).Rows.Count
    
    For i = 1 To k
        splitValues = Split(ActiveSheet.Cells(i, "A").Value)
        ActiveSheet.Cells(i, "B").Value = splitValues(0)
        ActiveSheet.Cells(i, "C").Value = splitValues(1)
    Next i
    End Sub
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by A Mysterious Lord)
    Still got it
    Code:
    Sub TestMacro()
    Dim sh As Worksheet
    Set sh = ThisWorkbook.Sheets("Sheet1";)
    
    Dim k As Long
    Dim str1() As String
    Dim str2() As String
    Dim i As Integer
    k = sh.Range("A1", sh.Range("A1";).End(xlDown)).Rows.Count
    
    For i = 1 To k
        splitValues = Split(ActiveSheet.Cells(i, "A";).Value)
        ActiveSheet.Cells(i, "B";).Value = splitValues(0)
        ActiveSheet.Cells(i, "C";).Value = splitValues(1)
    Next i
    End Sub
    Thank you so much ill try this
    Offline

    16
    ReputationRep:
    (Original post by souhm)
    Thank you so much ill try this
    Obviously change "Sheet1" to whatever your worksheet is called.
 
 
 
Poll
Are you going to a festival?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.