I have this code from before, which I need to create 38 reports from the one big report. It worked before, but we added something, and now it doesn't work. I never understood Loop procedure well although I read other answers
So here is the section I believe is making the issue. It needs to go through 5602 lines and it takes minutes to even get to 50.
Do While v <= n
If Cells(v, 2) <> "" And Cells(v, 2) <> "Call Center" And Cells(v, 2) <> drzava Then Rows(v).Delete Else v = v + 1
Loop
And this is the whole thing:
Sub SaveALLCountries()
Dim drzava$, nov As Workbook, ime$, v%, n%, a As Double
Application.ScreenUpdating = False
For i = 1 To 38
ThisWorkbook.Activate
Application.StatusBar = i
ThisWorkbook.Sheets("Results by CC").Range("CB14") = i
drzava = ThisWorkbook.Sheets("Results by CC").Range("CD12")
Workbooks.Add
Set nov = ActiveWorkbook
ThisWorkbook.Sheets("Results by CC").Copy Before:=nov.Sheets(1)
ActiveSheet.Shapes.Range(Array("List Box 2")).Delete
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
ThisWorkbook.Sheets("2018 Q2 Open answers").Copy Before:=nov.Sheets(2)
Application.DisplayAlerts = False
nov.Sheets(3).Delete
Sheets("2018 Q2 Open answers").Select
ActiveSheet.Outline.ShowLevels RowLevels:=2
n = Application.WorksheetFunction.CountA(Sheets("2018 Q2 Open answers").Columns(2)) + 10
v = 1
Do While v <= n
If Cells(v, 2) <> "" And Cells(v, 2) <> "Call Center" And Cells(v, 2) <> drzava Then Rows(v).Delete Else v = v + 1
Loop
ActiveSheet.Outline.ShowLevels RowLevels:=1
Range("A1").Select
ActiveWorkbook.Names("CallCenterSelect").Delete
Sheets("Results by CC").Select
ime = ThisWorkbook.Path & "\" & Sheets("Results by CC").Range("CD14").Value & ".xlsx"
nov.SaveAs ime, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
nov.Close
Next i
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub