Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default Macro to create seperate sheets

I have one worksheet containing a list of all sales from all salespeople,
salesperson's name is in column B with other details in further columns.


Eg Master sheet
Col B Col C Col D Col E
Salesperson Prodcuct Amount Discount
Simon XYZ 500 50
Simon ABC 600 50
Simon 123 400 10
Olivia ABC 650 50
Olivia DEF 660 60


I would like to break out Simons details onto one sheet and Olivias onto
another (seperate sheets already exist and with formulas in certain cells) so
that they appear on the new sheet in say range starting in C10 down.
The number of times that Simon and Olivia would appear would vary every time
the master sheet is created.

Any help would be much appreciated.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro to create seperate sheets

Public Sub ProcessData()
Const TEST_COLUMN As String = "B" '<=== change to suit
Dim i As Long
Dim LastRow As Long
Dim StartRow As Long
Dim sh As Worksheet

With ActiveSheet

LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 2 To LastRow + 1
If .Cells(i, TEST_COLUMN).Value < .Cells(i - 1,
TEST_COLUMN).Value Then
If i 2 Then
.Cells(StartRow, TEST_COLUMN).Resize(i - StartRow,
4).Copy sh.Range("C11")
End If
If i <= LastRow Then
Set sh = Worksheets(.Cells(i, TEST_COLUMN).Value)
sh.Cells.ClearContents
.Range("B1:E1").Copy sh.Range("C10")
StartRow = i
End If
End If
Next i

End With

End Sub

--
---
HTH

Bob


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



"Tony" wrote in message
...
I have one worksheet containing a list of all sales from all salespeople,
salesperson's name is in column B with other details in further columns.


Eg Master sheet
Col B Col C Col D Col E
Salesperson Prodcuct Amount Discount
Simon XYZ 500 50
Simon ABC 600 50
Simon 123 400 10
Olivia ABC 650 50
Olivia DEF 660 60


I would like to break out Simons details onto one sheet and Olivias onto
another (seperate sheets already exist and with formulas in certain cells)
so
that they appear on the new sheet in say range starting in C10 down.
The number of times that Simon and Olivia would appear would vary every
time
the master sheet is created.

Any help would be much appreciated.

Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
add two cells from seperate work sheets into a cell on seperate wo lar Excel Worksheet Functions 6 April 27th 10 06:54 PM
macro to move and save all sheets to seperate workbooks Todd Excel Programming 1 September 15th 06 12:16 AM
Macro to copy Column 1 of all sheets to a seperate sheet. Rajula Excel Programming 1 June 12th 06 05:34 PM
Use a macro to create new sheets [email protected] Excel Programming 6 July 8th 05 09:54 PM
Macro to query data from a succession of websites and display in seperate sheets DrSues02 Excel Programming 1 October 20th 04 09:22 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"