asked on
Dim Time0 As Boolean, cnt0 As Integer, File0 As String, Title0 As String, Window0 As String, RowID0 As String, Var1 As String, Var2 As String, Var3 As String, Var4 As String, Var5 As String, Var6 As String, Var7 As String, Var8 As String, Var9 As String, Var10 As String, Var11 As String
Time0 = True: cnt0 = 1: File0 = Application.ActiveWorkbook.Path & "\Departure List (of People already left).xls": Title0 = "Departure List (of People already left)": Window0 = "Departure List (of People already left).xls"
Rep0: 'Windows(Window1).Activate
'Debug.Print Window1
'Application.Workbooks(Window1).Activate
With ThisWorkbook.Worksheets("Main Sheet").Range("AJ1:AJ50000")
Set c = .Find(Search0, LookIn:=xlValues)
If Not c Is Nothing Then
Var1 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 3).Value
Var2 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 4).Value
Var3 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 5).Value
Var4 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 6).Value
Var5 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 7).Value
Var6 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 8).Value)
Var7 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 9).Value
Var8 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 16).Value)
Var9 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 17).Value)
Var10 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 19).Value)
Var11 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 20).Value
RowID0 = CStr(c.Row) & "CC"
'Windows(Window0).Activate
Application.Workbooks(Window0).Activate
If cnt0 = 1 Then
Set HOBook = Workbooks.Add
With HOBook
.Title = Title0
.Subject = Title0
.SaveAs Filename:=File0, FileFormat:=XlFileFormat.xlOpenXMLWorkbookMacroEnabled
.Close SaveChanges:=False
End With