View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lars Uffmann Lars Uffmann is offline
external usenet poster
 
Posts: 35
Default sorting multiple-area selection

Still finetuning this, but to give you what I have so far before I go
into lunch break:

Public Sub sortNotEmpty()
Dim ws As Worksheet

Set ws = ActiveSheet

ws.Range("A1:A100").AutoFilter 1, "0"
ws.Range("A1:B100").Sort ws.Range("A1"), xlAscending
ws.AutoFilterMode = False
End Sub


This does what you want, but if the first line is empty, it puts the
sort-filter there and somehow afterwards doesn't put the empty line
back. So need to work around this somehow. Otherwise, the above function
does what you want - might need to work on the filter criteria though.

Best Regards,

Lars