FORMULA
-----------------------------------------------------------------------------------------------------------------
Sub Segri_data()
f_loc = Application.FileDialog(msoFileDialogFolderPicker).Show
Path = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) & "\"
For x = 2 To Range("a1").End(xlDown).Row
If WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(x, 1)), Range("a" & x)) = 1 Then
Name = Range("a" & x)
Workbooks.Add.SaveAs Filename:=Path & Name, FileFormat:=51
ThisWorkbook.Activate
Range("a1:d1").AutoFilter field:=1, Criteria1:=Name
Range("a1").CurrentRegion.Copy
Workbooks(Name).Activate
Range("a1").PasteSpecial
Workbooks(Name).Close savechanges:=True
Application.CutCopyMode = xlCopy
ActiveSheet.AutoFilterMode = False
End If
Next x
End Sub
------------------------------------------------------------------------------------------------------------------
0 Comments