Monday Blues

dtaylor

Active Member
Joined
Mar 21, 2002
Messages
379
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
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I'm sure this can be done by code, but I believe you should also look at Advanced Filter or (my choice) MS Query. Much easier to maintain and much more flexible than hard coding names and such.
 
Upvote 0
I agree with the first respondent. I had a similar situation at my last job. I created one sheet with all raw data. I then put together a sheet with a pivot table that allowed me to slice and dice the data according to sales rep, region, etc. Sorry I don't have code for you, but I really think pivot tables or filtering will accomplish the same thing.

RF
 
Upvote 0
yes I agree with both of you, but my problem is I am not going to be doing the work and the user level fluctuates. that is why I am trying to do this with code.

Roccofan
using pivot tables did you setup one pivot table and move the data from there..like to a template?

if I cannot find a solution with vba I could train the users on using a pivot table with templates. MSQuery is diff not an option for my users, I have no problem with MSQuery, but my problem is that I don't want to do the work.

or

My last solution will be setting up an access database with a form to import and replace the data then create param query that loops through a listtbox and exports all selected item. I didn't want to go this route due to , once again user knowledge , and the amount of steps that would be needed. and also I would end up with around 55 files which I also did not want.

thanks fort the replys
 
Upvote 0
I don't see that MS Query would be a problem. I regularly create Speadsheets using it for instructionally challenged users(i.e. upper management). I simply create a parameter and link it to a cell. I use data validation to give them a drop down to choose the parameter and set the query to refresh automatically. Works like a charm.
In your case, they would select a saleman and viola, the figures appear.
Hint: I save the file as a template so they save over it and screw it up.
This message was edited by lenze on 2002-08-26 10:30
 
Upvote 0

Forum statistics

Threads
1,213,486
Messages
6,113,932
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top