sorting

new2vba

Board Regular
Joined
Aug 15, 2006
Messages
146
I have added a sort to an advancedfiltercopy, but it doesn't do the sort. any ideas?

Code:
Range("A1:i48").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
        "j1:j2"), CopyToRange:=Range("a201:b201"), Unique:=False
 

Range("a201:b201").Sort _
      Key1:=Range("b201"), _
      Order1:=xlAscending, _
      Header:=xlYes, _
      OrderCustom:=1, _
      MatchCase:=False, _
      Orientation:=xlTopToBottom
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Just giving it a cursory glance, it appears your sort range is only one row.

Range("a201:b201").Sort

Try:
Code:
    Range("A201:B300").Select
    Selection.Sort Key1:=Range("B202"), Order1:=xlAscending, Header:=xlGuess _
        , OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
[/quote]
 
Upvote 0
new issue

Just giving it a cursory glance, it appears your sort range is only one row.

Range("a201:b201").Sort

Try:
Code:
    Range("A201:B300").Select
    Selection.Sort Key1:=Range("B202"), Order1:=xlAscending, Header:=xlGuess _
        , OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
[/quote]After trying your solution, I realized some of the formatting I had applied to certain cells didn't move with the cell. To be more specific: I have the interior and border of some cells colored...after the sort, all of the interior colors are where they need to be, but some of the borders are not. any ideas?
 
Upvote 0
Hmm, I just tested it and yup, you're right; the patterns are o.k. but the borders aren't. Don't know - maybe someone else on the Board can help.
 
Upvote 0
Hmm, I just tested it and yup, you're right; the patterns are o.k. but the borders aren't. Don't know - maybe someone else on the Board can help.
Thanks Barry
 
Upvote 0

Forum statistics

Threads
1,213,563
Messages
6,114,332
Members
448,566
Latest member
Nickdozaj

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top