[TABLE="width: 500"]
<tbody>[TR]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]-8
[/TD]
[TD]123
[/TD]
[TD]-8
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]-8
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6
[/TD]
[TD]-8
[/TD]
[TD]-5
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-4
[/TD]
[TD]5
[/TD]
[TD]132
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-2
[/TD]
[TD]-3
[/TD]
[TD]131
[/TD]
[TD]5
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-8
[/TD]
[TD][/TD]
[TD][/TD]
[TD]4
[/TD]
[TD]999
[/TD]
[/TR]
</tbody>[/TABLE]
Dear all,
I’ve been struggling with the ending of my ratherlarge macro converting information out of our Financial bookkeeping system.
Little bit of context:
This is concerns outstanding invoices of clients,divided by client in rows and the amounts outstanding split in columns in a fewcategories. Categories being divided in:
There are numbers everywhere, mostly being positivenumbers.
The problem I face is that I try to have a Sortingcode in the macro, sorting the 5 columns, high to low(descending) but ignoring negativenumbers. It should look like this:
(Sorry, example of the table on top of the post, cant seem to get it here)
The sorting of the 0 or negatives is not important.
What have I tried?
1) Use ‘record macro’ and adjusting it with variables:
Hoped to be able to adjust the xlSortOnValues line orat alter the code.
2) I found this post on this forum; https://www.mrexcel.com/forum/excel-questions/1057699-vba-sort-ascending-descending-order-based-if-value-positive-negative.html
I have been trying to alter the code posted at may 31st,2018, 03:47PM, but unsuccessfully.
Now I have to admit, I’ve been using macro’s a lot byjust recording and altering the code to work on different variables. Myknowledge on VBA seems to be inferior.
Can any one perhaps push me in the right direction? Ifear to be needing to use Dimensions, which aren’t 100% clear for me yet.
<tbody>[TR]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]-8
[/TD]
[TD]123
[/TD]
[TD]-8
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]-8
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]6
[/TD]
[TD]-8
[/TD]
[TD]-5
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-4
[/TD]
[TD]5
[/TD]
[TD]132
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-2
[/TD]
[TD]-3
[/TD]
[TD]131
[/TD]
[TD]5
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]-8
[/TD]
[TD][/TD]
[TD][/TD]
[TD]4
[/TD]
[TD]999
[/TD]
[/TR]
</tbody>[/TABLE]
Dear all,
I’ve been struggling with the ending of my ratherlarge macro converting information out of our Financial bookkeeping system.
Little bit of context:
This is concerns outstanding invoices of clients,divided by client in rows and the amounts outstanding split in columns in a fewcategories. Categories being divided in:
- Not due
- 0-10 days due
- 11-20 days due
- 21-60 days due
- 60> days due
There are numbers everywhere, mostly being positivenumbers.
The problem I face is that I try to have a Sortingcode in the macro, sorting the 5 columns, high to low(descending) but ignoring negativenumbers. It should look like this:
(Sorry, example of the table on top of the post, cant seem to get it here)
The sorting of the 0 or negatives is not important.
What have I tried?
1) Use ‘record macro’ and adjusting it with variables:
Rich (BB code):
ActiveWorkbook.Worksheets("Blad1").Sort.SortFields.AddKey:=Range("F8", Range("F8").End(xlDown)), _
Rich (BB code):
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
Hoped to be able to adjust the xlSortOnValues line orat alter the code.
2) I found this post on this forum; https://www.mrexcel.com/forum/excel-questions/1057699-vba-sort-ascending-descending-order-based-if-value-positive-negative.html
I have been trying to alter the code posted at may 31st,2018, 03:47PM, but unsuccessfully.
Now I have to admit, I’ve been using macro’s a lot byjust recording and altering the code to work on different variables. Myknowledge on VBA seems to be inferior.
Can any one perhaps push me in the right direction? Ifear to be needing to use Dimensions, which aren’t 100% clear for me yet.