'VBA Run-Time Error '1004': Application-defined or object defined error

Hi can anyone help me with this,

I am quite new to VBA so it might be an easy fix, but I keep getting the

(Run-Time Error '1004': Application-defined or object defined error)

when I try to run this code. It normally will run but then says it afterwards.

Sub Insert_Row_PART_2()

Dim i As Integer
i = 1

Application.ScreenUpdating = False

Do Until Worksheets("Ref").Cells(i + 1, 3).Value > 10000
    
    Rows(Worksheets("Ref").Cells(i + 1, 3).Value).Select
    Selection.Insert Shift:=xlUp, CopyOrigin:=xlFormatFromRightOrBelow
    i = i + 1
    
Loop

Application.ScreenUpdating = True
  
End Sub

NOTE: The line giving me the error is: Rows(Worksheets("Ref").Cells(i + 1, 3).Value).Select

I am trying to insert rows on a sheet called MARA2+MARD2, while being on the sheet, based on the values in row 3 (C) in my sheet called "Ref".

Thank you in advance for any help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source