![Vba Vba](/uploads/1/2/5/4/125456163/967956667.png)
Apr 11, 2017 - Try this code: Dim lastrow As Long lastrow = Cells(Rows.Count, 2).End(xlUp).Row Range('A3:D' & lastrow).Sort key1:=Range('B3:B' & lastrow),. My problem is that sorting range on vba is between cell 2-295 and if I have 245 entries this week; i ended up having 48 row blank at a top as macro starts from the bottom up; it fills first 295 and leaves the rest 48 rows empty.
This Excel tutorial shows how to use custom VBA Excel Function to sort data in ascending order instead of using Filter. You may also want to read Use VBA Excel Function to sort data in ascending order In this tutorial, I will show how to use VBA Excel Function to sort data instead of using Filter. This was originally a question raised in Microsoft Community and was answered by me.