VBA: Sort on two columns

gio123bg

Active Member
Joined
Feb 14, 2004
Messages
255
Hi,
I have the necessity to execute a macro for sorting a list of data on two columns.
More exactly, let's suppose to have this situation:

A 10/2/2008 FFFF GGGG HHH
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
B 08/1/2008 HHHH SSSS IIIII
C 15/10/2008 AAA BBBB CCC

I need this sort:
A 10/2/2008 FFFF GGGG HHH
B 08/1/2008 HHHH SSSS IIIII
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
C 15/10/2008 AAA BBBB CCC

Any suggestion will be well appreciated.

Thanks in advance for your kind support.

Regars,

Giovanni
 
The issue here is to get the macro to automatically run this procedure on different spreadsheet , there are other procedures that run before this one to sort the data and they run perfectly ,how do i get the macro to also run this sort code/procedure without my interference?

The problem here is after sorting the data(adding headers, columns and separating text to numbers)i now want to sort the entire worksheet by "sales unit this year" then move to the last ACTIVE cell, then got to the next empty cell then put in that column and assign it to the data in column F then populate the data to the last cell that has data .

Repeat the above for the next worksheets ,taking notes on the dynamic number of worksheets and data on each worksheet



please see below
 

Attachments

  • data comes like this.png
    data comes like this.png
    17.1 KB · Views: 2
  • how i use sort method to move data into one column.png
    how i use sort method to move data into one column.png
    78.2 KB · Views: 2
  • i use an equal formula to bring the remainder of the data to column E.png
    i use an equal formula to bring the remainder of the data to column E.png
    14.8 KB · Views: 1
  • how data must be.png
    how data must be.png
    17.4 KB · Views: 2
  • macro error 1.png
    macro error 1.png
    47.7 KB · Views: 1
  • macro error 2.png
    macro error 2.png
    75.8 KB · Views: 0
  • the code with two procedures .png
    the code with two procedures .png
    125.2 KB · Views: 2
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
The issue here is to get the macro to automatically run this procedure on different spreadsheet , there are other procedures that run before this one to sort the data and they run perfectly ,how do i get the macro to also run this sort code/procedure without my interference?

The problem here is after sorting the data(adding headers, columns and separating text to numbers)i now want to sort the entire worksheet by "sales unit this year" then move to the last ACTIVE cell, then got to the next empty cell then put in that column and assign it to the data in column F then populate the data to the last cell that has data .

Repeat the above for the next worksheets ,taking notes on the dynamic number of worksheets and data on each worksheet



please see below
Since your question is different from the original, it is better to post it to a breand new thread instead of posting it on a thread that is over 5 years old.
It will then show up on the "Unanswered threads" listing, and have a much better chance of being seen and receiving replies.
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,702
Members
449,464
Latest member
againofsoul

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