The sheet1 worked fine but it wouldn't loop to the next worksheet.
If there is any way I can optimize my code, I would appreciate that too

Also, while I'm looping through the worksheets, is there a way that I could omit sheet11?
Would
If ws = sheet11 Then
exit for
End If
work?
Code: Select all
Sub Test()
Dim counter As Integer
counter = 1
Dim ws As Worksheet
Dim LR As Integer, temp1 As String
Dim Dupl As Boolean
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
LR = ws.Range("A" & ws.Rows.count).End(xlUp).Row
For c = 4 To LR
temp1 = ws.Range("A" & c).Value
Dupl = False
For d = 1 To Sheet11.Range("A" & Sheet11.Rows.count).End(xlUp).Row
If temp = Sheet11.Range("A" & d).Value Then
Dupl = True
Exit For
End If
Next d
If Dupl = False Then
Sheet11.Range("A" & counter).Value = temp1
Sheet11.Range("B" & counter).Value = ws.Range("B" & c).Value
End If
counter = counter + 1
Next c
Next ws
Application.ScreenUpdating = True
End Sub