Excel column sorting macro

newexler

New Member
Joined
Apr 3, 2009
Messages
18
Hi I have a spread sheet which may become huge once and i cannot reveal it.
However i would like to sort the spread sheet based on the coloumns, with a conditional "OK" in some occassions
1. selected 2 coloumns, if data is ok/OK the the entire row has to be copied to another sheet
2. on some occasions selected 3 coloumns has "ok/OK" then entire row has to be copied to another sheet
3. Some occassions if the selected 2 or 3 coloumns have "ok/OK" && AND if the a coloumn "x" is marked as "I" then the entire row has to copied to another sheet.
Please can i get help .. Please want a generic Macro so that i decide which coloumns to look for and what condition.

I created a sample spreadsheet, not sure how to attach it here.

Thanks in advance
--newexler
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
An example i would like to attach here is this

<table x:str="" style="border-collapse: collapse; width: 724pt;" border="0" cellpadding="0" cellspacing="0" width="965"><col style="width: 48pt;" span="10" width="64"> <col style="width: 244pt;" width="325"> <tbody><tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" x:num="" height="17" width="64">1</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">2</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">3</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">4</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">5</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">6</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">7</td> <td class="xl24" style="width: 48pt;" x:num="" width="64">8</td> <td class="xl24" style="width: 244pt;" width="325">Description</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 244pt;" width="325">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">OK</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">I</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 244pt;" width="325">Italy</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 244pt;" width="325">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 244pt;" width="325">Germany</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">OK</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">Ok</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 244pt;" width="325">Uraguay</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 244pt;" width="325">
</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">No</td> <td class="xl24" style="width: 48pt;" width="64">Ok</td> <td class="xl24" style="width: 48pt;" width="64">Ok</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">I</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 244pt;" width="325">Argentina</td> </tr> <tr style="height: 12.75pt;" height="17"> <td class="xl24" style="height: 12.75pt; width: 48pt;" height="17" width="64">Ok</td> <td class="xl24" style="width: 48pt;" width="64">ok</td> <td class="xl24" style="width: 48pt;" width="64">OK</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">I</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 48pt;" width="64">
</td> <td class="xl24" style="width: 244pt;" width="325">Spain</td> </tr> </tbody></table>
In here for each row if for (columns selected, 1, 2, 3 etc) copy the description in the results sheet. I might have to choose the coloumns based on the my search querry. So also the search sting could be ok/OK; if it is y/Y i will change it search string before running macro
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

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