Here you go
I have copied the whole code again, the new bit being in red.
Sub Tapyr()
Dim ag As String
Dim r, i, nr, Lastrow As Integer
Dim exists As Boolean
Lastrow = Sheets("Analysis").Range("C" & Rows.Count).End(3).Row
Application.DisplayAlerts = False
Application.ScreenUpdating = False
For r = 8 To Lastrow
exists = False
ag = Sheets("Analysis").Cells(r, "C").Value
For i = 1 To Worksheets.Count
If Worksheets(i).Name = "0l " & ag Then
exists = True
End If
Next i
If Not exists Then
Sheets("LL - Account3.1 BH").Copy After:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "0l " & ag
.Range("H9").Value = "0l " & ag
End With
Sheets("LL - Account3.1 BH").Copy After:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "Y1 " & ag
.Range("H9").Value = "Y1 " & ag
End With
End If
nr = Sheets("0l " & ag).Range("M" & Rows.Count).End(3)(2).Row
Sheets("Analysis").Range("G" & r).Copy Sheets("0l " & ag).Range("M" & nr)
Sheets("Analysis").Range("R" & r).Copy Sheets("0l " & ag).Range("G" & nr)
Sheets("Analysis").Range("G" & r).Copy Sheets("Y1 " & ag).Range("M" & nr)
Sheets("Analysis").Range("V" & r).Copy Sheets("Y1 " & ag).Range("G" & nr)
Next r
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks