Hi all
Please note first of all, my VBA knowledge is zero, but I am pretty good with excel and I did programming a long time ago at college so I can understand stuff. I'm just not experienced.
I have an Excel Table with a lot of columns (25 of them actually) and with a lot of items (about 2000 rows of data).
The correct way to sort it is multi-level and requires 9 different sorts. This takes a while (a bunch of clicking), is prone to mistakes, and more importantly other users may not know the right way to do this. So I want a magic button that does it all.
Before we get to the button itself (that's probably the easy part, although I've never done it), I started looking at the code that would do the sorting. I expected it to be pretty simple. With the help of Google and some YouTube videos, I ended up with this:
Please note:Please Login or Register to view this content.
- the Workbook is called "Invoices & Cashflow.xlsm".
- the Sheet on which the table is is called "Invoices" ("Sheet3" when looking at VBA dashboard)
- the Table itself is also called "Invoices" (this is confirmed in the Name Manager)
The error I am having is that it doesn't work. No matter how many new levels I add for sorting, only the first one works, i.e. the table gets sorted by "Cost Type" in ascending order, and everything stops there. This is of course not ideal. The last step should be "Payment Date", which supersedes all others.
Why aren't the other levels working? "Cost Type" is only the first step out of 9 in total...
Also, side note: I have no idea why ".Header = xlYes" is necessary, or what it does. I've noticed some online examples use it. It seems to make no difference to the result...
Thanks for helping out, much appreciated.
PS: any tips on the button are also appreciated, but I was going to search Google first before asking
Bookmarks