![]() |
|
#5
|
||||
|
||||
|
This is 'way more sophisticated than anything I've tried to do in Excel before. In Access, sure, but I've never used real forms in Excel, never more than the occasional button. I had to do some exploring to see how this thing hangs together. I'm impressed.
But I think I see what the problem is. You can, too: Put a break on the statement that's hanging up: Code:
.Sort.SortFields.Add Key:=.ListColumns(1), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
But Sortfields.Add Key:= wants not a ListColumn object but a Range; that's why the other form of the command works. I don't know anything about ListObjects, but I opened up one of the ListColumn objects and I see that Range is one of its properties. I infer that ListColumn is has many non-range properties so it can't be a range itself, but offers you the range as one of the properties. I changed your statement, therefore, to Code:
.Sort.SortFields.Add Key:=.ListColumns(1).Range, _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
|
| Tags |
| range, sort, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Outlook Combobox Sort Code | lms | Outlook | 1 | 09-18-2013 09:56 AM |
How to Sort Table Cells from Left to Right
|
tamaracklodge | Word Tables | 4 | 03-04-2013 04:00 AM |
| Sort table using macro | saslotteroy | Word VBA | 2 | 09-15-2011 02:41 PM |
How to sort table having three columns?
|
Bahir Barak | Word | 2 | 01-20-2011 01:52 PM |
| Can I sort a Pivot table by subtotals? | oshkosh | Excel | 1 | 12-07-2010 06:20 PM |