Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50076

[SOLVED] Error 2042

$
0
0
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.


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!

Viewing all articles
Browse latest Browse all 50076

Trending Articles