I'm trying to calculate the number of used rows in a VBA project in Excel 2013 so that I can fill it with a userform (everytime I press the Save button, it adds a new row to the worksheet). The worksheet also has two header rows, so I don't want them to be overwritten.
This should be accomplished by the following code that gets executed as soon as I press the Save button:
Private Sub Save_Click()
Dim totalRows As Long
totalRows = Daten.Cells(Rows.Count, "A").End(xlUp).Row
If totalRows < 2 Then
totalRows = 2
Else
totalRows = totalRows
End If
...
End Sub
However, when I press the Save button, I get the Error "424" Object Required".
I am really lost here - anyone knows what I'm doing wrong? If you need to know more, please tell me so, because I'd really want to see this work.