Skylar
asked on
VBA to split cells
I need help with splitting cell based on delimiter. please see attached file.
i have uploaded a file that shows Before and After.
i need to help with VBA to convert before sheet and create sheet like "AFTER" worksheet.
any help is appreciated.
EE.xlsx
i have uploaded a file that shows Before and After.
i need to help with VBA to convert before sheet and create sheet like "AFTER" worksheet.
any help is appreciated.
EE.xlsx
ASKER
thanks Norie. it brings the change into my existings sheet. how can i modify this, so that it create the new worksheet "After" and pastes the data there?
Is the heading the only difference???
ASKER
yes. only headings to be split as it is shown in the worksheet "AFTER"
simply put, i have the data as shown in worksheet "Before" and i need it to be added as new sheet like shown in the sheet "AFTER"
simply put, i have the data as shown in worksheet "Before" and i need it to be added as new sheet like shown in the sheet "AFTER"
Is the 'AFTER' sheet an existing sheet or do you want to add a new sheet, call it 'AFTER', transfer the data from 'BEFORE' to it and then do the split?
ASKER
in real work, i do not have "AFTER" worksheet. i have manually created it in this example, to show what i am looking for as result.
so, i only have the workbook called "BEFORE", so i need to run the macro, so that it creates the worksheet "AFTER"
so, i only have the workbook called "BEFORE", so i need to run the macro, so that it creates the worksheet "AFTER"
You can use the standard substring function from excel to take the right part of the string,
I prefer VB-Functions over VB-Subroutines,
=GetPart(sourceCell;"/";1) gives the first label part
=GetPart(sourceCell;"/";2) gives the second label part
=GetPart(sourceCell;"/";3) would gives the third if ist exist
(You can replace the "/" by any other value (if required)
I prefer VB-Functions over VB-Subroutines,
=GetPart(sourceCell;"/";1)
=GetPart(sourceCell;"/";2)
=GetPart(sourceCell;"/";3)
(You can replace the "/" by any other value (if required)
Function GetPart(dta As String, sep As String, part As Integer)
Dim DtaPart() As String
DtaPart = Split(dta, sep)
part = part - 1
GetaArt = DtaPart(part)
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Norie,
Thank you so very much!
this is exactly what i was imagining.
Thank you so very much!
this is exactly what i was imagining.
Open in new window