Split a Worksheet into Multiple Worksheets by a name

Darker1973

New Member
Joined
Jun 4, 2014
Messages
3
Hi,
I have a rather large company salary review tool cols A - BQ which I have built and needs to be split by Reviewer (col L).
The document has over 4869 lines of data but I want to keep all other functionality ie macro buttons and so on.
Basically it should be a copy worksheet, and then cut by reviewer. Can anyone help me with something, somehow to do this with some code? cheers


-- removed inline image ---
<tbody> </tbody>

-- removed inline image ---
<tbody> </tbody>

-- removed inline image ---
<tbody> </tbody>

-- removed inline image ---
<tbody> </tbody>

-- removed inline image ---
<tbody> </tbody>
Total Budget £ -
Total Spend To Date £ - Target Incentives not Actual Award to Compare Opportunity of Incentives Year on Year
Remaining Spend £ -
IDHRDPayrollSurnameFirst NameBU-1LPS BusinessBusiness NameUnitOrganization Supervisor1st Level
Salary Reviewer
2nd Level
Salary Reviewer
Actual No. Hours workedStart DateJob TitleCareer Grade NameCareer LevelJob Classification2013 Performance Rating 2014 Performance Rating Salary before
Last Change £
Last
Salary Change Date
Salary
% Change
Current Salary
£
INPUT
Promotion wef 1-7-2014 Y/N
PLEASE CHECK
New Grade wef 1-7-2014
TOWERS MATCHING CODELQ
Salary
Med
Salary
UQ
Salary
LQ
Salary - 2013 Aged Data
Med
Salary - 2013 Aged Data
UQ
Salary - 2013 Aged Data
LQ
Target Total Comp
Med
Target Total Comp
UQ
Target Total Comp
LQ
Target Total Comp - 2013 Aged Data
Med
Target Total Comp- 2013 Aged Data
UQ
Target Total Comp- 2013 Aged Data
Current Car Allowance
£
New Car Allowance July
Y/N
Car Allowance
1-7-2014
Increase Car Allowance July
£
Current Full time
Annual Salary
£
2013 Salary Market Data Positioning
If Available
INPUT
Salary Increase July 2014
£
INPUT
Salary Increase July 2014
%

New Salary July 2014
£
Salary Inc
%
New Salary Market Data Positioning
If Available
INPUT
Discretionary Bonus July 2014
£
Salary & Discretionary Bonus Spend 2014
£
2013
PPP / Sales Target %
2013
PPP / Sales Target £
2014
PPP Target %
2014
PPP Target
£
2014 Sales Target
%
2014 Sales Target
£
2013 Long Term Incentive
£
2014 Target Long Term Incentive
£
Previous FTE Target Total Comp (sal+car+
bonus+LTI)
New FTE Target Total Comp (sal+car+PPP/Sales+LTI) Change in Target Total Comp % o NEW Total Target Comp Positioning Reward/HR CommentManager / HR Comment
14896TESTTESTSurnameFirst NameBU-1LPS BusinessBusiness NameUnitOrganization SupervisorRobert Parker 37.504-Jan-2000Job TitleCareer Grade NameLevel 5Job Classification3 - Meets expectations £ 100 01/07/20130.00% £ 100 - - - - - - - - - - - - £ 100 Y £ 1,000 £ 900 £ 100 - £ 100 0.0% - £ - 10.0% £ 10 10% £ 10 0.0% £ - £ - £ - £ 210 £ 1,110 428.57% £ 900 -
302615TESTTESTScallyDamianBU-1LPS BusinessBusiness NameUnitOrganization SupervisorRobert Parker 37.530-Apr-2012Job TitleCareer Grade NameLevel 5Job Classification2 - Exceeds expectations £ 100 01/07/20130.00% £ 100 - - - - - - - - - - - - £ 100 N £ - - £ 100 - £ 100 0.0% - £ - 5.0% £ 5 5% £ 5 0.0% £ - £ - £ - £ 205 £ 105 -48.78% 100 -
314953TESTTESTAuerJensBU-1LPS BusinessBusiness NameUnitOrganization SupervisorRobert Parker 40.001-Oct-2013Job TitleCareer Grade NameLevel 5Job Classification - £ 100 01/10/20130.00% £ 100 - - - - - - - - - - - - £ 100 N £ - - £ 100 - £ 100 0.0% - £ - 2.0% £ 2 2% £ 2 0.0% £ - £ - £ - £ 202 £ 102 -49.50% 100 -
306766TESTTESTBasolKenanBU-1LPS BusinessBusiness NameUnitOrganization SupervisorRobert Parker 40.015-Sep-2012Job TitleCareer Grade NameLevel 5Job Classification3 - Meets expectations £ 100 01/07/20130.00% £ 100 - - - - - - - - - - - - £ 100 N £ - - £ 100 - £ 100 0.0% - £ - 2.0% £ 2 2% £ 2 0.0% £ - £ - £ - £ 202 £ 102 -49.50% 100 -
<colgroup><col width="65" style="width: 49pt; mso-width-source: userset; mso-width-alt: 2377;"> <col width="124" style="width: 93pt; mso-width-source: userset; mso-width-alt: 4534;"> <col width="54" style="width: 41pt; mso-width-source: userset; mso-width-alt: 1974;"> <col width="186" style="width: 140pt; mso-width-source: userset; mso-width-alt: 6802;"> <col width="232" style="width: 174pt; mso-width-source: userset; mso-width-alt: 8484;"> <col width="206" style="width: 155pt; mso-width-source: userset; mso-width-alt: 7533;"> <col width="70" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2560;"> <col width="293" style="width: 220pt; mso-width-source: userset; mso-width-alt: 10715;"> <col width="220" style="width: 165pt; mso-width-source: userset; mso-width-alt: 8045;"> <col width="230" style="width: 173pt; mso-width-source: userset; mso-width-alt: 8411;"> <col width="286" style="width: 215pt; mso-width-source: userset; mso-width-alt: 10459;"> <col width="128" style="width: 96pt; mso-width-source: userset; mso-width-alt: 4681;"> <col width="132" style="width: 99pt; mso-width-source: userset; mso-width-alt: 4827;"> <col width="71" style="width: 53pt; mso-width-source: userset; mso-width-alt: 2596;"> <col width="95" style="width: 71pt; mso-width-source: userset; mso-width-alt: 3474;"> <col width="267" style="width: 200pt; mso-width-source: userset; mso-width-alt: 9764;"> <col width="262" style="width: 197pt; mso-width-source: userset; mso-width-alt: 9581;"> <col width="83" style="width: 62pt; mso-width-source: userset; mso-width-alt: 3035;"> <col width="174" style="width: 131pt; mso-width-source: userset; mso-width-alt: 6363;"> <col width="252" style="width: 189pt; mso-width-source: userset; mso-width-alt: 9216;"> <col width="205" style="width: 154pt; mso-width-source: userset; mso-width-alt: 7497;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="2"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="95" style="width: 71pt; mso-width-source: userset; mso-width-alt: 3474;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="12"> <col width="86" style="width: 65pt; mso-width-source: userset; mso-width-alt: 3145;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="3"> <col width="91" style="width: 68pt; mso-width-source: userset; mso-width-alt: 3328;"> <col width="110" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4022;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="2"> <col width="89" style="width: 67pt; mso-width-source: userset; mso-width-alt: 3254;" span="2"> <col width="110" style="width: 83pt; mso-width-source: userset; mso-width-alt: 4022;"> <col width="106" style="width: 80pt; mso-width-source: userset; mso-width-alt: 3876;"> <col width="100" style="width: 75pt; mso-width-source: userset; mso-width-alt: 3657;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="4"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;" span="3"> <col width="88" style="width: 66pt; mso-width-source: userset; mso-width-alt: 3218;"> <col width="96" style="width: 72pt; mso-width-source: userset; mso-width-alt: 3510;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2998;"> <col width="285" style="width: 214pt; mso-width-source: userset; mso-width-alt: 10422;" span="2"> <tbody> </tbody>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi Darker,
Please be sure to run this on a copy of your file as I have NOT tested this macro. This is a variation of something that I use all the time.

Code:
Sub XL_Split_by_Reviewer()


ActiveSheet.Name = "Complete"
LastRow = Cells(Rows.Count, 1).End(xlUp).Row


'   ***** Robert Parker *****


Rows("1:1").AutoFilter
Range("L:L").AutoFilter Field:=12, Criteria1:=Array("Robert Parker"), Operator:=xlFilterValues
 
Range("A1:AV" & LastRow).SpecialCells(xlCellTypeVisible).Select
Application.Application.CutCopyMode = False
Selection.Copy


With ActiveWorkbook.Sheets
    .Add After:=Sheets(Sheets.Count)
End With
ActNm = ActiveSheet.Name
ActiveSheet.Name = "Robert Parker"
Sheets("Parker").Paste


Sheets("Complete").Select


'   ***** John Doe *****


ActiveSheet.ShowAllData
Range("L:L").AutoFilter Field:=12, Criteria1:=Array("John Doe"), Operator:=xlFilterValues
 
Range("A1:AV" & LastRow).SpecialCells(xlCellTypeVisible).Select
Application.Application.CutCopyMode = False
Selection.Copy


With ActiveWorkbook.Sheets
    .Add After:=Sheets(Sheets.Count)
End With
ActNm = ActiveSheet.Name
ActiveSheet.Name = "John Doe"
Sheets("John Doe").Paste


 
End Sub

What this does is filters based on the name in Column L, copies visible cells only and pastes into a new worksheet. I hope this works for you.
Cheers!
 
Upvote 0
Hi Darker,
Please be sure to run this on a copy of your file as I have NOT tested this macro. This is a variation of something that I use all the time.

Code:
Sub XL_Split_by_Reviewer()


ActiveSheet.Name = "Complete"
LastRow = Cells(Rows.Count, 1).End(xlUp).Row


'   ***** Robert Parker *****


Rows("1:1").AutoFilter
Range("L:L").AutoFilter Field:=12, Criteria1:=Array("Robert Parker"), Operator:=xlFilterValues
 
Range("A1:AV" & LastRow).SpecialCells(xlCellTypeVisible).Select
Application.Application.CutCopyMode = False
Selection.Copy


With ActiveWorkbook.Sheets
    .Add After:=Sheets(Sheets.Count)
End With
ActNm = ActiveSheet.Name
ActiveSheet.Name = "Robert Parker"
Sheets("Parker").Paste


Sheets("Complete").Select


'   ***** John Doe *****


ActiveSheet.ShowAllData
Range("L:L").AutoFilter Field:=12, Criteria1:=Array("John Doe"), Operator:=xlFilterValues
 
Range("A1:AV" & LastRow).SpecialCells(xlCellTypeVisible).Select
Application.Application.CutCopyMode = False
Selection.Copy


With ActiveWorkbook.Sheets
    .Add After:=Sheets(Sheets.Count)
End With
ActNm = ActiveSheet.Name
ActiveSheet.Name = "John Doe"
Sheets("John Doe").Paste


 
End Sub

What this does is filters based on the name in Column L, copies visible cells only and pastes into a new worksheet. I hope this works for you.
Cheers!

/
Thanks for this - is there a way to take in multiple names - ie 100 and loop through rather than a named name - ?
 
Upvote 0
Hi,

It certainly works for the filtering and sets up a new worksheet named Robert Parker but then I receive "Subscript out of Range",(my columns go from A:BQ - which I have amended in the code)

I also need this to split by whatever the name that is in L -it may be any name - is this possible?

Thanks again

Darker


 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

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