Thread: Sorting problem
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Sorting problem

Dim rng as Range
Dim rng1 as Range
On Error Resume Next
set rng = Columns(2).SpecialCells(xlblanks)
set rng1 = Intersect(rng.EntireRow,Columns("A:B"))
rng1.Delete shift:=xlShiftUp
On Error goto 0

--
Regards,
Tom Ogilvy


"Bri" wrote in message
...
This one has me stymied. My worksheet collects data in columns A and B
corresponding to ID and MonSales. This is repeated in columns C and D
corresponding to ID and TueSales, and so on. Repeats of values in any
column are allowed.

My problem is that there are many instances where a row has no value of A
or B. I have code that sorts A:B by A ascending, then B descending, but
these 'blanks' go to the top of the sort. I don't know how to get rid of
them. Deleting rows doesn't work because it interferes with the data in
C:D, E:F, etc. Needless to say, this sorting needs to be done for each
column pair.

I would very much appreciate help with this.
Thanks - Bri