Forum Discussion
wktay
Jan 09, 2024Copper Contributor
VBA sorting for flexible table
Howdy all, Just learning how to use VBA to do sorting Index Name Buyer 23 Apple William 56 Pear Jone 49 Banana May 31 Durian Andy Above list is not fixed. There m...
- Jan 10, 2024Set uR = ActiveSheet.UsedRange
.SetRange uR
JKPieterse
Jan 09, 2024Silver Contributor
instead of .SetRange Range("A1", Range("A1").End(xlDown))
use
.SetRange Range("A1").CurrentRegion
use
.SetRange Range("A1").CurrentRegion
wktay
Jan 10, 2024Copper Contributor
Thank you, but what if there is an empty row? Basically empty row should go to very bottom
| Index | Name | Buyer |
| 23 | Apple | William |
| 56 | Pear | Jone |
| 49 | Banana | May |
| 31 | Durian | Andy |
- JKPieterseJan 10, 2024Silver Contributor
Empty rows within data are considered bad practice. Your data looks like a table, I advise to use Format as table, that will make this easier.
- peiyezhuJan 10, 2024Bronze ContributorSet uR = ActiveSheet.UsedRange
.SetRange uR- wktayJan 11, 2024Copper ContributorThank you very much