Sort all columns based on one colum

G

Greg

I have column N that has data validation of only "Yes" . i would like to move
the rows with the "Yes" value in column N to the bottom of the sort.
i have a sort button with this code below. What would i need to insert to do
this?
Sub SortSunday()
'
'Sort's Sundays Qualifying'
'

ActiveSheet.Unprotect Password:=""
With ActiveSheet
With .Range("B8", .Range("N8").End(xlDown))
.Sort Key1:=.Columns(12), Order1:=xlAscending, _
Key2:=.Columns(11), Order2:=xlDescending, _
Header:=xlYes
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True, Password:=""

End With
End With
End Sub

Many Thanks in Advance!
Greg
 
B

Bernie Deitrick

Greg,

It depends on what values you have in column N other than Yes.

Bernie
 
G

Greg

Thanks Bernie,
i was wondering if anyone understood what i was asking.
the column will be either blank or yes. i used data validation from list
with only yes as an option.

Thanks
Greg
 
B

Bernie Deitrick

Greg,

I have assumed that column O (the one next to N) is available for use to help with sorting.

HTH,
Bernie
MS Excel MVP

Sub SortSunday()
'
'Sort's Sundays Qualifying'
'

ActiveSheet.Unprotect Password:=""
With ActiveSheet
With .Range("B8", .Range("M8").End(xlDown).Offset(0, 2))
.Columns(.Columns.Count).Cells.FormulaR1C1 = "=IF(RC[-1]=""Yes"",1,0)"
.Sort Key1:=.Columns(14), Order1:=xlAscending, _
Key2:=.Columns(12), Order2:=xlDescending, _
Key3:=.Columns(11), Order3:=xlDescending, _
Header:=xlYes
.Columns(.Columns.Count).Cells.Clear
ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, Scenarios:=True, Password:=""
End With
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top