Create new excel files based on the data in a column
Closed
ExcelTrey
Posts
1
Registration date
Monday March 13, 2017
Status
Member
Last seen
March 14, 2017
-
Mar 14, 2017 at 06:56 PM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - Mar 17, 2017 at 08:31 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - Mar 17, 2017 at 08:31 AM
Related:
- Create new excel files based on the data in a column
- Create rar files mac - Guide
- How to open excel file in notepad - Guide
- Create instagram account on pc - Guide
- Excel mod apk for pc - Download - Spreadsheets
- Transfer data from one excel worksheet to another automatically - Guide
1 response
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
Updated by vcoolio on 17/03/17 at 08:40 AM
Updated by vcoolio on 17/03/17 at 08:40 AM
Hello ExcelTrey,
Try the following code (untested),assigned to a button and in a copy of your workbook first:-
The code should create a new file for each name in Column F with the relevant rows of data for each name being transferred to the relevant file. Each new file will be saved in the same folder as your main file.
I hope that this helps.
Cheerio,
vcoolio.
P.S.: You may be interested in the following query in another forum. Its amazingly close to your own query and has a very good resolution clearly set out:-
https://www.eileenslounge.com/viewtopic.php?f=27&t=24342
Try the following code (untested),assigned to a button and in a copy of your workbook first:-
Sub CreateNewWbks()
Dim dic As Object, rng As Range, wks As Worksheet, mypath As String, lr As Long
Set dic = CreateObject("scripting.dictionary")
Set wks = Sheet1
mypath = ThisWorkbook.Path & "\"
lr = wks.Range("F" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With wks
For nr = lr To 2 Step -1
If (Not dic.exists(.Cells(nr, "F").Value)) Then
dic.Add .Cells(nr, "F").Value, .Cells(nr, "F").Value
Set rng = .Range("A1:I" & .Cells(Rows.Count, 1).End(xlUp).Row)
rng.AutoFilter field:=6, Criteria1:=.Range("F" & nr).Value
rng.Copy
Workbooks.Add
ActiveSheet.Paste
ActiveSheet.Columns.AutoFit
ActiveSheet.[A1].Select
ActiveWorkbook.SaveAs Filename:=mypath & .Range("F" & nr).Value & ".xlsx"
ActiveWorkbook.Close
End If
Next
.AutoFilterMode = False
End With
MsgBox "All Done!", vbExclamation
Application.CutCopyMode = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
The code should create a new file for each name in Column F with the relevant rows of data for each name being transferred to the relevant file. Each new file will be saved in the same folder as your main file.
I hope that this helps.
Cheerio,
vcoolio.
P.S.: You may be interested in the following query in another forum. Its amazingly close to your own query and has a very good resolution clearly set out:-
https://www.eileenslounge.com/viewtopic.php?f=27&t=24342