Pasta1.xlsm | ||||
---|---|---|---|---|
A | B | |||
1 | Group 1 | Group 2 | ||
2 | 4 | 5 | ||
3 | 3 | 7 | ||
4 | 3 | 6 | ||
5 | 2 | 5 | ||
6 | ||||
7 | ||||
8 | 2 | |||
sheet 1 |
When I sort column A from largest to smallest, it automatically interferes with column B. I tried in different ways, but I couldn't make the filter of column A not interfere with B and vice versa as well. My goal is to sort the names in columns A and B in order from highest to lowest, without interfering with the other columns.
I'm also trying to make the filter automatically update every time a change is made, so I'm using the following VBA:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("sheet 1").AutoFilter.ApplyFilter
End Sub
However, the filter sometimes fails as demonstrated in the xl2bb example, leaving empty cell ranges instead of sorting.
I tried to use tables with a filter instead of the simple filter as an alternative, I used the same VBA but in addition to failing a few times when sorting the cells, sometimes when adding data to the cells I got the error "Runtime Error 9 is a Visual BASIC error o which stands for Object Variable Not Defined".
Last edited by a moderator: