Thanks for the amended sub, Bob. I tested it over several runs here. Noticed
that the sub misses out TEST_COLUMN's blank cells if these are located right
at the bottom. In-between blank cells are spliced ok into "Blanks". Could
this be rectified?
(Rest of the scenarios work fine)

Signature
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
The problem here Max is that it tests column A to find the last row, and so
misses those tail blanks.
Best to use a more generic lastrow function
Option Explicit
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iRow As Long
Dim sh As Worksheet
Dim shName As String
With ActiveSheet
iLastRow = LastRow(ActiveSheet)
For i = 2 To iLastRow
If IsError(.Cells(i, TEST_COLUMN).Value) Then
shName = "Err"
ElseIf .Cells(i, TEST_COLUMN).Value = "" Then
If .Cells(i, TEST_COLUMN).HasFormula Then
shName = "NS"
Else
shName = "Blanks"
End If
Else
shName = .Cells(i, TEST_COLUMN).Value
End If
Set sh = Nothing
On Error Resume Next
Set sh = Worksheets(shName)
On Error GoTo 0
If sh Is Nothing Then
Set sh = Worksheets.Add
sh.Name = shName
.Rows(1).Copy sh.Range("A1")
iRow = 2
Else
iRow = sh.UsedRange.Rows.Count + 1
End If
.Rows(i).Copy sh.Range("A" & iRow)
Next i
.Activate
End With
End Sub
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

Signature
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
> Thanks for the amended sub, Bob. I tested it over several runs here.
> Noticed that the sub misses out TEST_COLUMN's blank cells if these are
> located right at the bottom. In-between blank cells are spliced ok into
> "Blanks". Could this be rectified?
>
> (Rest of the scenarios work fine)
Max - 13 Jul 2007 14:35 GMT
Apologies for the delayed reply, Bob.
Yes, your last amendment did it.
Runs superb. Thanks!

Signature
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---