View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Sorting help !!!!!!!!!!!!!!!!!

I keep getting a "Application-defined or object-defined error" with the code
below.

I am tring to sort by columns B, C, D and I. Row(4) has the Header for the
data range. I am using Excel 2007 but people with Excel2003 need to be able
to use it too hence this sorting code.
What am I doing wrong here? Help!!!!!!!!!!

With ActiveWorkbook.Worksheets("Report 1").Range("B4:AX" & BOReport_lastRow)
.Cells.Sort _
key1:=Columns(2), order1:=xlAscending, _
key2:=Columns(3), order2:=xlAscending, _
key3:=Columns(4), order3:=xlAscending, _
key4:=Columns(9), order4:=xlAscending, _
Header:=xlYes
End With