Hello,
I have a workbook,data changes every two days but format stays same, with data in col a:ag. This file needs to be broken up by Sales Rep (col a). Whats needs to happen is for each diff sales rep in col 'a' a worksheet is inserted and the tab named the sales rep name (col a data). Then the data for that sales rep copied and placed in new worksheet. This is where my problem is. Each sales rep can have varied sized ranges. One rep can have 10,000 lines and one could have 500 lines.
With the code below I am able to identify each sales rep in col 'a', create a sheet and have it named the sales rep and then copy the sale name from col 'a', but I am only capturing one cell. I need all data associated with that rep. Can someone help me get over this, I know there is a way but it eludes me.
Range("a1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
For Each rCells In Range("a3", Range("a65536").End(xlUp))
If rCells <> rCells.Offset(-1, 0) Then
rCells.EntireRow.PageBreak = xlPageBreakManual
Sheets.Add
ActiveSheet.Range("a1") = rCells.Offset(-1, 0)
ActiveSheet.Name = rCells.Offset(-1, 0)
Any assistance would be appreciated!
dan
I have a workbook,data changes every two days but format stays same, with data in col a:ag. This file needs to be broken up by Sales Rep (col a). Whats needs to happen is for each diff sales rep in col 'a' a worksheet is inserted and the tab named the sales rep name (col a data). Then the data for that sales rep copied and placed in new worksheet. This is where my problem is. Each sales rep can have varied sized ranges. One rep can have 10,000 lines and one could have 500 lines.
With the code below I am able to identify each sales rep in col 'a', create a sheet and have it named the sales rep and then copy the sale name from col 'a', but I am only capturing one cell. I need all data associated with that rep. Can someone help me get over this, I know there is a way but it eludes me.
Range("a1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
For Each rCells In Range("a3", Range("a65536").End(xlUp))
If rCells <> rCells.Offset(-1, 0) Then
rCells.EntireRow.PageBreak = xlPageBreakManual
Sheets.Add
ActiveSheet.Range("a1") = rCells.Offset(-1, 0)
ActiveSheet.Name = rCells.Offset(-1, 0)
Any assistance would be appreciated!
dan