Hi all,
I am totally new to VBA, its my first code.
I wanted to create macro which could insert a row after finding different value.
I managed to write something like this.
Could you pleas check what is causing the error 1004 - Application defined or object-defined error?
I am totally new to VBA, its my first code.
I wanted to create macro which could insert a row after finding different value.
I managed to write something like this.
Could you pleas check what is causing the error 1004 - Application defined or object-defined error?
PHP:
Sub InsertRow()
Dim i As Integer
Dim j As Integer
j = Application.WorksheetFunction.Count(Range("A:A"))
Sheets("Raport").Activate
For i = 1 To j
If Sheets("Raport").Range(Cells(i + 2, 2)) <> Sheets("Raport").Range(Cells(i + 1, 2)) Then
Range(Cells(i + 1, 2)).Insert(Shift:=xlShiftDown) = 1
i = i + 1
End If
Next i
End Sub