Each block is different number of rows, but always the same number of
columns wide.
Thanks in advance!
TIA
Option Explicit
Sub testme333()
Dim const_rng As Range
Dim form_rng As Range
Dim const_form_rng As Range
Dim myRange As Range
Dim myArea As Range
Set myRange = Range("a1", Cells(Rows.Count, "a").End(xlUp))
If Application.CountA(myRange) < 2 Then
MsgBox "Put some data in column A!"
Exit Sub
End If
On Error Resume Next
Set const_rng = myRange.SpecialCells(xlCellTypeConstants)
Set form_rng = myRange.SpecialCells(xlCellTypeFormulas)
Set const_form_rng = Union(const_rng, form_rng)
On Error GoTo 0
If const_form_rng Is Nothing Then
If Not const_rng Is Nothing Then
Set const_form_rng = const_rng
End If
If Not form_rng Is Nothing Then
Set const_form_rng = form_rng
End If
End If
If const_form_rng Is Nothing Then
MsgBox "nothing in column A"
Else
For Each myArea In const_form_rng.Areas
myArea.Resize(, 8).Sort Key1:=myArea(1).Offset(0, 4), _
order1:=xlAscending, _
Header:=xlNo
Next myArea
End If
End Sub
(this looks for any formulas and any constants in column A. Then operates
against each separate piece.)
I resized the range to be 8 columns wide. And used .0ffset(0,3) as the sort
key. (.offset(0,3) = column D if the range is in A.)
--
Dave Peterson
ec3...@msn.com
for each rngArea in rng.Areas
rngArea.Resize(,5).Sort . . .
Next
change 5 to the number of columns.
Regards,
Tom Ogilvy
Bob Wall <rbw...@fedex.com> wrote in message
news:3CA8C8E2...@fedex.com...
--
Dave Peterson
ec3...@msn.com
As always, thanks to both of you for your help!
BW
Regards,
Tom Ogilvy
"Bob Wall" <rbw...@fedex.com> wrote in message
news:3CA92AC4...@fedex.com...