View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Humphrey Bogart Humphrey Bogart is offline
external usenet poster
 
Posts: 1
Default Sort control doesn't sort top line

I have a spreadsheet with several columns, and a control button above each
one to sort the sheet by that column.

For one of the columns, it sometimes (not always) leaves the first row out
of the sort (first row remains on top, rest of the rows get sorted.

The sort buttons occupy rows 1 and 2, the column headings are on row 3, and
the data begins in row 4. Here is the code behind the button:

Private Sub Sort_status_Click()
Range("A4:D200").Sort Key1:=Range("D4"), Order1:=xlAscending,
Header:=xlGuess, OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
End Sub