Hi,

I'm trying to write a code that will search the row for the word "Novartis". If the row contains the word - it will be the first column that will contain it - the whole row will be copied to another worksheet.

The first worksheet (one where we are searching for the word) is called "Consolidation" and the second worksheet is called "Novartis" - this is the worksheet we are copying the row to.

Here is my code:

Sub Novartis_Loop()

Dim erow As Long

    x = 7
    Do While Cells(x, 1) <> ""
    
        If Cells(x, 1) = "Novartis" Then
        Worksheets("Consolidation").Rows(x).Copy
        Worksheets("Novartis").Activate
        erow = Novartis.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        ActiveSheet.Paste Destination:=Worksheets("Novartis").Rows(erow)
        End If
        
    Worksheets("Consolidation").Activate
    x = x + 1
    Loop
        
End Sub
Whenever I try to run the macro, I come up with an error telling me Error 424 The object is not defined, with the row of code starting with erow highlighted, or an error saying Can't execute code in break mode.

Can anybody see what is wrong with my code?