user7351900
user7351900

Reputation:

How can I sort based on descending numbers in a single cell?

I have values in a cell that look like this:

0 AND 
1 AND 
3 AND 
4 AND 
2 OR 

I want the result to looks like this:

0 AND 
1 AND 
2 OR 
3 AND 
4 AND 

Each value is separated by a line break (char(10)). How can I run a small script to sort these values?

Thanks.

Upvotes: 0

Views: 58

Answers (1)

user7351900
user7351900

Reputation:

Ahh, yes. Thanks for the tip. When I did it your way, it turned out to be super easy!

        Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals

            ' SORT ASCENDING BOOLEAN VALUES
            Range("BC2").Select
            Range(Selection, Selection.End(xlToRight)).Select
            With ActiveWorkbook.Worksheets("NEW Format").Sort
                .SetRange Selection
                .Apply
            End With
            Range("BC1").Select

I don't need to rejoin at the end. I need to split out this array and concatenate it with elements of another array.

Thank you!

Upvotes: 1

Related Questions