try this code and tell me this is waht you asked for?
Option Explicit
Sub myTest()
Dim i As Integer, n As Integer
Dim wSht As Worksheet
Dim Wbk As Workbook
Dim bottomB As Long
Dim bottomC As Long
Dim fPath As String
Dim myObj As Object
fPath = "C:\Users\pad71381\Documents\newPhots" ' change the path name
If Not Right(fPath, 1) = "\" Then fPath = fPath & "\"
Set wSht = ThisWorkbook.Worksheets("Sheet1") 'change the sheet name
bottomB = wSht.Cells(Rows.Count, 2).End(xlUp).Row
bottomC = wSht.Cells(Rows.Count, 3).End(xlUp).Row
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 2 To bottomB
If wSht.Cells(i, 2) <> "" Then
Set Wbk = Workbooks.Add
For n = 2 To bottomC
With Wbk
If wSht.Cells(n, 3) <> "" Then
If Not Evaluate("ISREF('" & wSht.Cells(n, 3) & "'!A1)") Then
.Sheets.Add(after:=Sheets(Sheets.Count)).Name = wSht.Cells(n, 3)
End If
End If
End With
Next n
End If
Set myObj = CreateObject("Scripting.FileSystemObject")
If myObj.FileExists(fPath & wSht.Cells(i, 2) & ".xlsx") = True Then
If MsgBox("There is Workbook already open" & vbCrLf & "Do you want Replace Exists one Click Yes" & _
vbCrLf & "To Abort Action Click No", vbYesNo) = vbYes Then
Wbk.SaveAs fPath & wSht.Cells(i, 2)
Wbk.Close
Else
Wbk.Close False
Exit For
End If
Else
Wbk.SaveAs fPath & wSht.Cells(i, 2)
Wbk.Close
End If
Next i
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Set myObj = Nothing
End Sub
Bookmarks