The Student Room Group
University College London, University of London
University College London
London

Excel VBA help???

Anyone out there willing to help?? Thank you so much !
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
University College London, University of London
University College London
London
Reply 2
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 ?
Haven't done any for 7 years now, what do you need to do?

EDIT: I see.
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.
Reply 5
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 ?
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?
Reply 7
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.
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.
Reply 9
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
Original post by souhm
Yeah I have to use VBA..


Posted from TSR Mobile


Give me 15 minutes.
Reply 11
Original post by A Mysterious Lord
Give me 15 minutes.


cool :biggrin:
Still got it :smile:

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
Reply 13
Original post by A Mysterious Lord
Still got it :smile:
Sub TestMacro()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1":wink:

Dim k As Long
Dim str1() As String
Dim str2() As String
Dim i As Integer
k = sh.Range("A1", sh.Range("A1":wink:.End(xlDown)).Rows.Count

For i = 1 To k
splitValues = Split(ActiveSheet.Cells(i, "A":wink:.Value)
ActiveSheet.Cells(i, "B":wink:.Value = splitValues(0)
ActiveSheet.Cells(i, "C":wink:.Value = splitValues(1)
Next i
End Sub


Thank you so much ill try this
Original post by souhm
Thank you so much ill try this


Obviously change "Sheet1" to whatever your worksheet is called.

Quick Reply

Latest

Trending

Trending