Create new sheets based on Column A data.
Solved/Closed
josh07429
Posts
14
Registration date
Friday June 23, 2017
Status
Member
Last seen
November 20, 2017
-
Updated on Jul 5, 2017 at 11:28 PM
Jay - Apr 26, 2019 at 04:54 PM
Jay - Apr 26, 2019 at 04:54 PM
Related:
- Excel create sheets based on column
- Create skype account with gmail - Guide
- Excel macro to create new sheet based on value in cells - Guide
- To create a network bridge you must ✓ - Network Forum
- Create instagram account on pc - Guide
- Dash becomes date on excel ✓ - Office Software Forum
2 responses
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
Jul 6, 2017 at 12:01 AM
Jul 6, 2017 at 12:01 AM
Hello Josh,
I don't see an image but see if the following code (untested) does the job for you:-
As you have a large data set, the code uses the Scripting Dictionary (a very quick method) to create sheets from the values in Column A and then transfer the relevant rows of data to each individual sheet.
Each sheet is named after each value in Column A without duplication.
Place the code in a standard module and assign it to a button.
I hope that this helps.
Cheerio,
vcoolio.
I don't see an image but see if the following code (untested) does the job for you:-
Sub CreateNewShtsTransferData() Dim lr As Long, x As Long Dim ID As Object Dim key As Variant Dim sht As Worksheet Dim ws As Worksheet Set sht = Sheet1 Set ID = CreateObject("Scripting.Dictionary") Application.ScreenUpdating = False Application.DisplayAlerts = False lr = sht.Range("A" & Rows.Count).End(xlUp).Row For x = 2 To lr If Not ID.Exists(sht.Range("A" & x).Value) Then ID.Add sht.Range("A" & x).Value, 1 End If Next x For Each key In ID.keys If Not Evaluate("ISREF('" & key & "'!A1)") Then Worksheets.Add(After:=Sheets(Sheets.Count)).Name = key End If Set ws = Worksheets(CStr(key)) '---->This converts the vehicle numbers to text values otherwise the code will error. sht.Range("A1:A" & lr).AutoFilter 1, key sht.[A1].CurrentRegion.Copy ws.[A1] ws.Columns.AutoFit sht.[A1].AutoFilter Next key sht.Select Application.CutCopyMode = False Application.DisplayAlerts = True Application.ScreenUpdating = True MsgBox "All done!", vbExclamation End Sub
As you have a large data set, the code uses the Scripting Dictionary (a very quick method) to create sheets from the values in Column A and then transfer the relevant rows of data to each individual sheet.
Each sheet is named after each value in Column A without duplication.
Place the code in a standard module and assign it to a button.
I hope that this helps.
Cheerio,
vcoolio.
Jul 6, 2017 at 11:18 AM
It works and its really fast, please make me your student :)
Apr 26, 2019 at 04:54 PM