Hello to all!
Can anyone give a hand, i have this macro that breack up data into tabs base on a specific column values:
Sub DistributeRows1()
Dim wsAll As Worksheet
Dim wsCrit As Worksheet
Dim wsNew As Worksheet
Dim LastRow As Long
Dim LastRowCrit As Long
Dim i As Long
Set wsAll = Worksheets("Global")
LastRow = wsAll.Range("A" & Rows.Count).End(xlUp).Row
Set wsCrit = Worksheets.Add
wsAll.Range("O1:O" & LastRow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=wsCrit.Range("A1"), Unique:=True
LastRowCrit = wsCrit.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRowCrit
Set wsNew = Worksheets.Add
wsNew.Name = wsCrit.Range("A2")
wsAll.Rows("1:" & LastRow).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=wsCrit.Range("A1:A2"), _
CopyToRange:=wsNew.Range("A1"), Unique:=False
wsCrit.Rows(2).Delete
Next i
Application.DisplayAlerts = False
wsCrit.Delete
Application.DisplayAlerts = True
End Sub
is possible to modify this code to breack into files instead of sheets, this new file will be placed into a specific folderin hte same directory.
Also i will nedd to do the opposite, meaning after analyst work on this new created files i will need to pull them together into one master file.
Thanks in advance.
Can anyone give a hand, i have this macro that breack up data into tabs base on a specific column values:
Sub DistributeRows1()
Dim wsAll As Worksheet
Dim wsCrit As Worksheet
Dim wsNew As Worksheet
Dim LastRow As Long
Dim LastRowCrit As Long
Dim i As Long
Set wsAll = Worksheets("Global")
LastRow = wsAll.Range("A" & Rows.Count).End(xlUp).Row
Set wsCrit = Worksheets.Add
wsAll.Range("O1:O" & LastRow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=wsCrit.Range("A1"), Unique:=True
LastRowCrit = wsCrit.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRowCrit
Set wsNew = Worksheets.Add
wsNew.Name = wsCrit.Range("A2")
wsAll.Rows("1:" & LastRow).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=wsCrit.Range("A1:A2"), _
CopyToRange:=wsNew.Range("A1"), Unique:=False
wsCrit.Rows(2).Delete
Next i
Application.DisplayAlerts = False
wsCrit.Delete
Application.DisplayAlerts = True
End Sub
is possible to modify this code to breack into files instead of sheets, this new file will be placed into a specific folderin hte same directory.
Also i will nedd to do the opposite, meaning after analyst work on this new created files i will need to pull them together into one master file.
Thanks in advance.