engineerseay
New Member
- Joined
- Mar 13, 2018
- Messages
- 7
I have a large amount of data to separate into columns. I am fairly new to VBA, so I need help figuring it out. I have done a fair amount of searching which led to many failed attempts.
So the current column data looks like this: 2 P011954 88135 SKIN, COLONIST, TEXTURED, 6 PANEL, 3/0 X 8/0
I want to separate it into 4 different columns. 2, P011954, 88135, & (SKIN, COLONIST, TEXTURED, 6 PANEL, 3/0 X 8/0) remaining.
currently this is my code: (cant figure out how to add a screen shot) I know it is not really doing anything at the moment.
So the current column data looks like this: 2 P011954 88135 SKIN, COLONIST, TEXTURED, 6 PANEL, 3/0 X 8/0
I want to separate it into 4 different columns. 2, P011954, 88135, & (SKIN, COLONIST, TEXTURED, 6 PANEL, 3/0 X 8/0) remaining.
currently this is my code: (cant figure out how to add a screen shot) I know it is not really doing anything at the moment.
Code:
'** PROGRAM PURPOSE:SEPARATE QTY, PART #, TITAN #, AND DISCRIPTION INTO SEPERATE CELLS.
'** INPUTS/OUTPUTS: STING OF DATA/ SEPARATED DATA
'** NOTES:
'**
'**************************************************************************************************
Sub SEPARATE()
Dim I As Integer
Dim qty, part, titan, discription, J, n, x As String
Application.ScreenUpdating = False
For Each Sheet In Worksheets
Sheet.Activate
I = 5 'I is used to indentify starting row.
Columns.AutoFit
For I = 5 To 100 'Continue loop until row 100
J = Cells(I, 4).Value
qty = Split(J, " ", 2)
n = Cells(I, 5).Value
part = Split(n, " ", 2)
'ActiveCell.Resize(1, UBound(part) + 1).Offset(0, 1) = part -Tried this and it did not work
x = Cells(I, 6).Value
titan = Split(x, "S", 2)
'ActiveCell.Resize(1, UBound(titan) + 1).Offset(0, 1) = titan
Next I
Columns.AutoFit
Next Sheet
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: