Sortting macro problem

Aperras7

New Member
Joined
May 22, 2014
Messages
36
Hi all,

I'm using a really simple macro to sort some cata in a table and I'm experiencing some trouble.

The first row of my column is an if formula that reference me a data depending on if the product is required or not. That the main reason why I used a Macro to sort them since everytime the "required" information changes, a new name might appear at the bottom of the list.

Here's the formula : =IFERROR(IF(INGREDIENTS!Q207="P2 - Soft Spec";INGREDIENTS!A207;"");"")

And here's the super basic VBA i'm using :

Sub Sort_P2s()
'
' Sort_P2s Macro
'
ActiveWorkbook.Worksheets("P2s reco").ListObjects("Tableau3").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("P2s reco").ListObjects("Tableau3").Sort.SortFields. _
Add Key:=Range("Tableau3[[#All],[Products]]"), SortOn:=xlSortOnValues, _
Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("P2s reco").ListObjects("Tableau3").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub


This works fine to sort my datas in the first row, but everything else in the table doesn't follow this information. The thing is, the other info are manual entries.

Here's an example off the table :


ProductsSubmission dateManuf codeManufSysco #Us FoodsDescriptionPack sizeDelivered Price
formula manual entrymanual entrymanual entrymanual entrymanual entrymanual entrymanual entrymanual entry
Bread2014-08-15433872Hilltop89896634567bread, yummy8/36 oz42,79$

<tbody>
</tbody>


I really don't understand why the sort doesn't take the information to the right of the first column and drag them with the initial info...

Anybody can help me?

Thanks,
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
show us 10 rows of your spreadsheet before you sort it and define how you want to sort it, please
 
Upvote 0
show us 10 rows of your spreadsheet before you sort it and define how you want to sort it, please

ProductsSubmission dateManuf CodeManufSysco #US FoodsDescriptionPack Size Delivered price

=IFERROR(IF(INGREDIENTS!Q1="P2 - Soft Spec";INGREDIENTS!A1;"");"")
=IFERROR(IF(INGREDIENTS!Q2="P2 - Soft Spec";INGREDIENTS!A2;"");"")
...
Naked Juice - Blue Machine12-dec-201434245345354647658987978juice8 each65.78$
Naked Juice - Green Machine
Naked Juice - Strawberry Banana
Bread - Sliced, Rye Reuben
Bread - Wheat Berry Thick Sl





I would like to sort per name in a ascending or descending way. sorry for the formatting of my exemple, i'm new here! d'ont need to be a multiple level sort

<tbody>
</tbody><colgroup><col><col><col span="2"><col><col><col><col><col></colgroup>
 
Upvote 0
you are not explaining it very well, a simple spreadsheet, copy, go to this forum,paste, and we see it. Or explain the problem in terms of apples and bananas and colours and codes and say what you want to do. Once we know this, it will be sorted foryou
 
Upvote 0
If you can explain the problem you face at its most basic in generic terms you will get the assistance you need....
 
Upvote 0

Forum statistics

Threads
1,217,394
Messages
6,136,367
Members
450,006
Latest member
DaveLlew

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