Pramod Pandit
Pramod Pandit

Reputation: 121

How to sort data using a custom list which contains numbers using VBA?

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

Upvotes: 0

Views: 231

Answers (1)

guest76
guest76

Reputation: 11

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'

Upvotes: 1

Related Questions