Can anyone help me with why I'm getting Error 2042 on the second part of my code?
I've underlined the syntax that's being shown as an error. When I hover over ce = "No" it tells me it's Error 2042.
Much appreciated!
I've underlined the syntax that's being shown as an error. When I hover over ce = "No" it tells me it's Error 2042.
Code:
Sub Check()
outrow = 5
For Each ce In Sheets("sheet1").Range("tbl_1")
If ce = "No" Then
Cells(outrow, 1).Value = ce.Offset(0, -21).Value
Cells(outrow, 2).Value = ce.Offset(0, -10).Value
Cells(outrow, 3).Value = ce.Offset(0, -36).Value
outrow = outrow + 1
End If
Next ce
For Each ce In Sheets("sheet2").Range("tbl_2")
If ce = "No" Then
Cells(outrow, 1).Value = ce.Offset(0, -21).Value
Cells(outrow, 2).Value = ce.Offset(0, -17).Value
Cells(outrow, 3).Value = ce.Offset(0, -22).Value
outrow = outrow + 1
End If
Next ce
ActiveSheet.Range("Dashboard[#All]").RemoveDuplicates Columns:=Array(1, 2, 3), _
Header:=xlYes
End Sub
Much appreciated!