Hi,

Could u see the error..

Regards



On Sun, Mar 23, 2014 at 6:29 PM, Deepak Rawat <deepakexce...@gmail.com>wrote:

> i tried the code but giving ubound error, sample is attached,
> kindly check
>
>
> On Sun, Mar 23, 2014 at 6:19 PM, Deepak Rawat <deepakexce...@gmail.com>wrote:
>
>> Hi,
>> i tried but not working but showing #Value! Error
>>
>> Pls look into...
>>
>> Regards,
>> Deepak
>>
>>
>> On Thu, Mar 20, 2014 at 5:33 PM, Divaker Pandey <divake...@gmail.com>wrote:
>>
>>> use below code
>>>
>>>
>>> Sub sortCellsValue()
>>>  Dim tempStr As String, resultSet As String
>>>  Dim tempstrArr() As String
>>>
>>>  Dim i As Integer
>>>  For Each cl In ThisWorkbook.Sheets("Sheet1").Range("A2:A271")
>>>    tempstrArr = Split(cl.Value, ",")
>>>    tempstrArr = removeDuplicate(tempstrArr)
>>>    For i = 0 To UBound(tempstrArr)
>>>     For j = i + 1 To UBound(tempstrArr)
>>>      If (Trim(tempstrArr(i)) > Trim(tempstrArr(j))) Then
>>>          tempStr = tempstrArr(i)
>>>          tempstrArr(i) = tempstrArr(j)
>>>          tempstrArr(j) = tempStr
>>>       End If
>>>     Next
>>>     Next
>>>
>>>     tempStr = Join(tempstrArr, ",")
>>>
>>>       cl.Offset(0, 1).Value = tempStr
>>>  Next
>>>  End Sub
>>>
>>>
>>> Function removeDuplicate(tempstrArr() As String) As String()
>>> Dim i As Integer, j As Integer, count As Integer
>>> Dim newArr() As String
>>>
>>> For i = 0 To UBound(tempstrArr)
>>>     For j = 0 To count
>>>      If (Trim(tempstrArr(i)) = Trim(tempstrArr(j))) Then
>>>           Exit For
>>>       End If
>>>       Next
>>>       If j = count Then
>>>        ReDim Preserve newArr(count)
>>>         newArr(count) = tempstrArr(i)
>>>         count = count + 1
>>>        End If
>>>
>>> Next
>>>
>>> removeDuplicate = newArr
>>> End Function
>>>
>>>
>>>
>>> On Thu, Mar 20, 2014 at 3:44 PM, Deepak Rawat 
>>> <deepakexce...@gmail.com>wrote:
>>>
>>>> Hi Dipanke,
>>>>
>>>> One more query i have, please do me favor
>>>> I have lots of cells which contains duplicate comma desperated values
>>>> like given below
>>>>
>>>> Audi, BMW, Audi
>>>> BMW, BMW, Toyota
>>>> Honda, Toyota, BMW, Honda
>>>>
>>>> After cleaning it should be look like below:
>>>>
>>>> Audi, BMW
>>>> BMW, Toyota
>>>> BMW, Honda, Toyota
>>>>
>>>>
>>>>
>>>> could duplicate value be deleted by macro, kindly help
>>>>
>>>> Regards,
>>>> Deepak Rawat
>>>>
>>>>
>>>>
>>>>  On Thu, Mar 20, 2014 at 2:40 PM, Divaker Pandey 
>>>> <divake...@gmail.com>wrote:
>>>>
>>>>> use this macro
>>>>>
>>>>>
>>>>> Sub sortCellsValue()
>>>>>  Dim tempStr As String, resultSet As String
>>>>>  Dim tempStrArr() As String
>>>>>  Dim i As Integer
>>>>>  For Each cl In ThisWorkbook.Sheets("Sheet1").Range("A2:A271")
>>>>>   tempStrArr = Split(cl.Value, ",")
>>>>>
>>>>>    For i = 0 To UBound(tempStrArr)
>>>>>     For j = i + 1 To UBound(tempStrArr)
>>>>>      If (Trim(tempStrArr(i)) > Trim(tempStrArr(j))) Then
>>>>>       tempStr = tempStrArr(i)
>>>>>       tempStrArr(i) = tempStrArr(j)
>>>>>       tempStrArr(j) = tempStr
>>>>>      End If
>>>>>     Next
>>>>>     Next
>>>>>
>>>>>     tempStr = Join(tempStrArr, ",")
>>>>>       cl.Offset(0, 1).Value = tempStr
>>>>>  Next
>>>>>  End Sub
>>>>>
>>>>>
>>>>> On Thu, Mar 20, 2014 at 2:30 PM, Deepak Rawat <deepakexce...@gmail.com
>>>>> > wrote:
>>>>>
>>>>>> yes but its very time consuming to do mannually sort...
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 20, 2014 at 2:26 PM, VJ IR <vji...@gmail.com> wrote:
>>>>>>
>>>>>>> Have u tried using text to columns??
>>>>>>>
>>>>>>> Its a simple way to do so.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Vijay Iyer
>>>>>>> On 20 Mar 2014 14:23, "Deepak Rawat" <deepakexce...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Dear All,
>>>>>>>>
>>>>>>>> I have attached a sheet with rawa data  & final data.
>>>>>>>>
>>>>>>>> I need a macro to sort coma separated data in each cell, like
>>>>>>>> example is given below:
>>>>>>>>
>>>>>>>> NDTV, BBC, Aaj Tak, Facebook we need to change it as below
>>>>>>>>
>>>>>>>> *Aaj Tak, BBC, Facebook, NDTV*
>>>>>>>>
>>>>>>>> i have lots of data to sort, but not getting any solution to do
>>>>>>>> quickly
>>>>>>>>
>>>>>>>> Thanks & Regards,
>>>>>>>> Deepak
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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 http://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 http://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 http://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 http://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 http://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 http://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 http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to