Hi Dev,, little long process but working as per your requirement. Check this out !!!!
Option Explicit Sub SortRangeData() Dim sh1 As Worksheet, sh2 As Worksheet Dim rng1 As Range, rng2 As Range, rng As Range, data As Range Dim arr As Variant, arr2 As String, txt As String Dim i As Long Set sh1 = ActiveSheet On Error Resume Next Set data = Application.Selection Set data = Application.InputBox("Selet Data", Type:=8) Application.DisplayAlerts = False Application.ScreenUpdating = False For Each rng1 In data arr = VBA.Split(rng1, ",") Worksheets.Add after:=Sheets(Sheets.Count) Set sh2 = ActiveSheet For i = 0 To UBound(arr) sh2.Cells((i + 1), 1).Value = arr(i) Next i sh2.Range("A1", Range("A" & Rows.Count).End(xlUp)).Select With Selection sh2.Sort.SortFields.Clear sh2.Sort.SortFields.Add Key:=Range("A1"), Order:=xlAscending End With With sh2.Sort .SetRange Selection .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With For Each rng In Selection txt = rng & "," arr2 = arr2 & txt Next rng sh2.Delete rng1.Value = arr2 arr2 = "" Next rng1 If ActiveSheet.Name <> sh1.Name Then sh1.Activate Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub *PJ * *MIS Analyst* *Greater Kailash-1, New Delhi.* *Instagram* *pj_sharma_* *Tweeter* *dude_sharma_pj**Facebook** www.facebook.com/dude.pj <http://www.facebook.com/dude.pj>* *We meet for a reason, either you're a blessing or a lesson...* ---------- Forwarded message ---------- From: Devendra Sahay <devendrasahanypt...@gmail.com> Date: Fri, Jan 15, 2016 at 2:35 PM Subject: Re: $$Excel-Macros$$ Sorting Comma Separated Values in a cell To: excel-macros@googlegroups.com Hi Mandeep, Please revert, as I am facing a big issue because of this. Thanks On Fri, Jan 15, 2016 at 11:33 AM, Devendra Sahay < devendrasahanypt...@gmail.com> wrote: > Hi Mandeep, > > Please revert. > > > On Thu, Jan 14, 2016 at 5:37 PM, Devendra Sahay < > devendrasahanypt...@gmail.com> wrote: > >> Hi, >> >> I dont want to sort column a, I want to sort the comma separated data >> alphabetically & numerically in column 2. >> >> but the code which i have shared, it shorts the data of column a & b >> both, So all the data shuffled >> >> This is the required format of the data. >> >> Col 1 Col 2 >> A 10,15,5 year,8year >> B 15,17,20year >> D 12,30,50 year >> >> >> >> On Thu, Jan 14, 2016 at 5:27 PM, Mandeep Baluja <rockerna...@gmail.com> >> wrote: >> >>> Hey Devendra, >>> >>> Asked for output format? your query is not understandable. data shuffled >>> all the data ??, >>> >>> Show me the output you require for this data given below :- >>> >>> Col 1 Col 2 >>> A 10,8year,5 year,15 >>> B 15,20year,17 >>> D 30,50 year,12 >>> >>> -- >>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? >>> It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ >>> https://www.facebook.com/discussexcel >>> >>> FORUM RULES >>> >>> 1) Use concise, accurate thread titles. Poor thread titles, like Please >>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >>> will not get quick attention or may not be answered. >>> 2) Don't post a question in the thread of another member. >>> 3) Don't post questions regarding breaking or bypassing any security >>> measure. >>> 4) Acknowledge the responses you receive, good or bad. >>> 5) Jobs posting is not allowed. >>> 6) Sharing copyrighted material and their links is not allowed. >>> >>> NOTE : Don't ever post confidential data in a workbook. Forum owners and >>> members are not responsible for any loss. >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "MS EXCEL AND VBA MACROS" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to excel-macros+unsubscr...@googlegroups.com. >>> To post to this group, send email to excel-macros@googlegroups.com. >>> Visit this group at https://groups.google.com/group/excel-macros. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> With Regard !!! >> Devendra Rahi >> >> > > > -- > > With Regard !!! > Devendra Rahi > > -- With Regard !!! Devendra Rahi -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
Comma Separated (solved).xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12