I have a work question and i want my macro to do the following
i have two columns (column A and B). Column A has the names and column B contains their info.
I want my macro to find duplicate names and copy both col A and B and paste them into another spreadsheet in the following location
C:\Users\kentan\Desktop\Managed Fund
Each spreadsheet created must contain the name of that name as the file name
I have create the macro to do the following but it's not giving me the right result
Sub IRIS()
Dim i As Integer
With ActiveSheet.Sort
.SetRange Range("A:B")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlStroke
.Apply
End With
i=1
Do Until Len(Cells(i, 1).Value) = 0
If Cells(i, 1).Value = Cells(i + 1, 1).Value Then
Range(Cells(i, 1), Cells(i, 2)).Select
Selection.Copy
Workbooks.Add
Range("A1").PasteSpecial
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\kentan\Desktop\Managed Fund" & cells(i,1) & ".xls"
ActiveWorkbook.Close
Else
i = i + 1
End If
Loop
Application.CutCopyMode = False
End Sub