0

I have a Custom List made which contains Numbers only and when I try to sort the Data's using the Custom List, it simply sorts the Data's in Ascending/Descending order and does not sort based on the arrangement of Custom List. How do we sort the data using a Custom List containing Numbers only.

The idea that i came up with is to add a string to the Custom List data as well as data that need to be sorted and then sort it. Is it possible to sort data's without changing/adding anything in worksheet ?

Picture Reference

3
  • Seeing sample data and the expected outcome would be useful here Commented Aug 12, 2022 at 14:24
  • Link to the sample file is attched : drive.google.com/file/d/1OgvYM4EeXqN4rvoyvcjumFlmh81iVw_H/… ... Try using both Numeric and String column data ! Replace the Blue colored cells on both sheets with Numeric and String column data ! Commented Aug 12, 2022 at 14:55
  • After that run the macro and you'll see that Numeric data will sort on ascending order irrespective to Custom list where as String data will sort based on Custom list. Commented Aug 12, 2022 at 15:03

1 Answer 1

1

Not sure if the rows.count is syntax right, but something along the lines of:

'Sort range "rng1" (eg. A4:X100) by descending Range A'

rng1.Sort key1:=Range("A4:A" & Rows.Count), Order1:=xlDescending

'or other option Order1:=xlAscending'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.