automatically sort a table after changing a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with a colmun that has restricted values to Yes/No. Default
entry is No. Is it possible to have the table sort itself, so that when this
cell is changed to Yes, the table sorts itself and puts the rows with Yes in
that cell at the bottom of the table? Obviously this is very easy to do by
just sorting it, but as this entry changes a lot and the workbook is shared
amongst several people, it would be easier if it could be done automatically,
rather than manually.

thanks
 
Hi

Did you try something like this


Private Sub Worksheet_Change(ByVal Target As Range)
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
'you can change the column here change from d to whatever
Range("a1:" & "d" & rowcount).Select
'you can change the sort column here change from d to whatever
'you can change also if there is heater here form Header:=xlNo t
Header:=xlYes
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
'Range("a1").Select

End Su
 

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

Back
Top