Splitting up a file

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
705
Office Version
  1. 365
Platform
  1. Windows
I have a file with about 2500 rows. The top row is a header. Column A shows clients. One client can have anywhere from 1 row to 50+ rows.
I need a macro that'll split the large file up so each client has a single file (or tab in this worksheet - either would work) with just their info. EX: John Smith is the name that appears in 33 rows so a new file (or tab) is created that has the header row and the 33 rows of data where John Smith is in column A.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
How about
VBA Code:
Sub SandsB()
   Dim Ary As Variant
   Dim i As Long
   
   With Sheets("Sheet1")
      Ary = Application.Unique(.Range("A2", .Range("A" & Rows.Count).End(xlUp)))
      For i = 1 To UBound(Ary)
         .Range("A1").AutoFilter 1, Ary(i, 1)
         Sheets.Add(, Sheets(Sheets.Count)).Name = Ary(i, 1)
         .AutoFilter.Range.Copy Range("A1")
      Next i
      .AutoFilterMode = False
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,202
Messages
6,123,625
Members
449,109
Latest member
Sebas8956

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