Solved

Split sheet out 0-26

Posted on 2013-12-12
5
191 Views
Last Modified: 2013-12-12
Hi,

I have a wb with 27 client types, 161k rows of data on sheet 1

I would like a macro that can split the data out in ascending order 0,1,2,3,4 etc

So my first tab will be the full data and then the other tabs, starting at 0,1,2 etc etc

Any ideas?

Thanks
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39714231
Hi Seamus.

I think we need a little more information about the problem and if possible an example workbook. What are your columns?!?
0
 

Author Comment

by:Seamus2626
ID: 39714239
Apologies, i forgot the wb
Client-Types-EE.zip
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39714305
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39714777
Sub Filtertosheets()
Dim rng As Range
Dim sws As Worksheet
Set sws = ActiveSheet
Set rng = Range("A1")
'Sheet1.Cells.Copy Sheet2.Cells
rng.EntireColumn.Insert
Range(rng.Offset(, -1), rng.End(xlDown).Offset(, -1)).Formula = "=row()"
Range(rng.Offset(, -1), rng.End(xlDown).Offset(, -1)).Value = Range(rng.Offset(, -1), rng.End(xlDown).Offset(, -1)).Value
rng.CurrentRegion.Sort key1:=rng, order1:=xlAscending, key2:=rng.Offset(, -1), order2:=xlAscending, Header:=xlYes
For i = 0 To 26
Sheets.Add , Sheets(Sheets.Count)
ActiveSheet.Name = "CT" & i
    rng.CurrentRegion.AutoFilter Field:=2, Criteria1:=i
    rng.CurrentRegion.Offset(, 1).SpecialCells(xlCellTypeVisible).Copy Range("A1")
Next i
sws.Select
rng.AutoFilter
rng.CurrentRegion.Sort key1:=rng.Offset(, -1), order1:=xlAscending, Header:=xlYes
rng.Offset(, -1).EntireColumn.Delete
End Sub

Open in new window

0
 

Author Closing Comment

by:Seamus2626
ID: 39714838
Hero!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question