Asatoma Sadgamaya
asked on
Separate content into different cells in Microsoft Excel
Hi
In my Excel sheet, one cell contains data like aa, bb, cc, dd, adfd, hls, sfa, ........ I need to separate each content separated by comma into different cells. please see example below.
Column A1 =aa
Column A2=bb
Column A3=cc
Column A4=dd
Column A5= adfd
I am looking for VBA script to do this task.
Thank you
A
In my Excel sheet, one cell contains data like aa, bb, cc, dd, adfd, hls, sfa, ........ I need to separate each content separated by comma into different cells. please see example below.
Column A1 =aa
Column A2=bb
Column A3=cc
Column A4=dd
Column A5= adfd
I am looking for VBA script to do this task.
Thank you
A
ASKER
Hi Subodh,
I have tested, but your code just replicates Sheet1 on Output
Sorry, on my question, content has less number of characters. I tried below but code has failed to separate it.
eg. Column A1= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,dddddddddddddddddddddd,cccccccccccccccccccccccccccc
Thank you
A
I have tested, but your code just replicates Sheet1 on Output
Sorry, on my question, content has less number of characters. I tried below but code has failed to separate it.
eg. Column A1= aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,dddddddddddddddddddddd,cccccccccccccccccccccccccccc
Thank you
A
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help on this Subodh
You're welcome Asatoma! Glad I could help.
Hi In my opinion it would be better to use Power Query.
I recommend you to begin studying Power BI
Regards,
Yolanda
I recommend you to begin studying Power BI
Regards,
Yolanda
As Yolanda suggested, you may also use Power Query to split the cell content by a delimiter into rows and it's one step query.
Refer to the attached with the Power Query Solution. If data changes in the cell A2 on Sheet1, you just need to click inside the table on Sheet2 and choose Refresh and the table would be updated.
SplitCellContent.xlsx
Refer to the attached with the Power Query Solution. If data changes in the cell A2 on Sheet1, you just need to click inside the table on Sheet2 and choose Refresh and the table would be updated.
SplitCellContent.xlsx
Open in new window
In the attached, click the button called "Split Cell Content" to run the code to get the desired output on Output Sheet.
SplitCellContent.xlsm