View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Mathews Paul Mathews is offline
external usenet poster
 
Posts: 84
Default Macro for sorting within groups

Arjun, perhaps I'm misunderstanding your question but isn't this just a data
sort on the data range containing the two columns below where the primary
sort field is "Number" and the secondary sort field is "Name" and both are
sorted in ascending order? If so, click DataSort then indicate the two sort
fields and ascending.

"Arjun" wrote:

I'm trying to sort within two groups. Here's an example:

Name Number
aw 2
ad 2
ce 1
fv 1

I am trying to sort the groups (with the number 2) alphabetically. I havent
been able to figue out a macro that upon recognizing the 1 can highlight both
the rows containing it. I do have a macro for the group '2', but would really
appreciate it if someone can show me a more general one.

thanks in advance