Manually editing Sort function in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I Have beem attempting to manually do my own sorting in VBA, but to no
avail. So I record a macro that sorts, and that works fine. BUT, if I want
to edit it, it no longer works, also, If I manually type the EXACT same
arguement , it doesnt work. The only thing that works so far in VBA, is just
running the macro and cutting it and pasting it to my macro.

Here is what excel records

Rows("1:11").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlDescending, Key2:=Range("B2") _
, Order2:=xlDescending, Header:=xlYes, OrderCustom:=1,
MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:= _
xlSortNormal
 
I have had the situation where i needed to sometimes do
multiple sorts. what i did was have a sort macro for each
way i needed to sort. that way i didn't need to edit the
sort macro. in one file i had the sort macros assigned to
2 buttons on the sheets. the user could sort one way by
click one button then sort the other way by click the
other button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top