View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Any ideas on how to do this?

Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long
Dim StartAt As Long
Dim wb As Workbook

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
StartAt = 1
For i = 2 To LastRow + 1

If .Cells(i, "A").Value < .Cells(i - 1, "A").Value Then

Set wb = Workbooks.Add
.Rows(StartAt).Resize(i - StartAt).Copy
wb.Worksheets(1).Range("A1")
wb.SaveAs .Path & Application.PathSeparator & .Cells(i - 1,
"A").Value
wb.Close
StartAt = 1
End If
Next i

Set wb = Nothing
End With

End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"michael.beckinsale" wrote in message
...
Hi All,

I have a table of data that looks some thing like this:

Column A Column B Column C
British Isles Salesman A 123
British Isles Salesman A 345
British Isles Salesman A 123456
British Isles Salesman B 9876
British Isles Salesman B 6789
British Isles Salesman C 7532
Europe Salesman 1 98475
Europe Salesman 1 9692
Europe Salesman 1 598310
Europe Salesman 2 6533
Europe Salesman 2 35678
Europe Salesman 3 9643
Europe Salesman 3 1423
Europe Salesman 4 7643
etc

What l want to do is create the following using the data in the table:

A workbook called 'Britsh Isles' with sheets for each salesman
containing each row of data
A workbook called 'Europe' with sheets for each salesman containing
each row of data

There will always be a variable number of Regions, Salesman & Data
rows

The workbooks should ideally be saved in the same directory as the
originating workbook.

Does anybody have any VBA code to achieve this or can they point me in
the right direction please?

All ideas gratefully received.

Regards

Michael