ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sort only rows with data (https://www.excelbanter.com/excel-programming/430135-re-sort-only-rows-data.html)

joel

sort only rows with data
 
One way is to put a string of zeroes in the blank cell sort they get moved to
the lat rows. Then sort and remove the Z's

Sub SortRows()

Set SortColumn = Range("V11:V74")

For Each cell In SortColumn
If cell = "" Then
cell = "ZZZZZZZZZZZ"
End If
Next cell

Rows("11:74").Sort _
key1:=SortColumn, _
Order1:=xlAscending, _
header:=xlNo

SortColumn.Replace what:="ZZZZZZZZZZZ", replacement:=""


End Sub


"usmc-r70" wrote:

I have a spreadsheet with a data range from A11:AR74, with the sort column
being 'V'.

I need a macro button to sort rows 11:74 in assending order for those rows
with data in column 'V' greater than zero, leaving those rows with zero in
column 'V' below the 'populated' rows.

Additionally, I need to disable the manual sort and auto filter features,
leaving the macro button as the only means to sort on this worksheet.



All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com