I've got an Excel Spreadsheet with multiple Sheets containing various Information from our company's employees (mitarbeiter). Now, I created an array containing their names, which are the same as the Worksheet names. I tought of using this to loop through all sheets one by one, retrieving some information and print it on another sheet i prepared.
At last, I was trying to select each worksheet to see if it was selecting the right sheets....which ended up with "Runtime Error 424-object required"
Sub Makro3()
Dim mitarbeiter As Variant
Dim lastrow As Long
Dim lastrowcol As Long
ReDim mitarbeiter(0 To 12) As Variant
mitarbeiter = Split(*censored*)
For i = LBound(mitarbeiter) To UBound(mitarbeiter)
With Sheets(mitarbeiter(i))
lastrow = .Cells(Rows.count, 13).End(xlUp).Row
lastrowcol = .Cells(Rows.count, 13).End(xlUp).Column
End With
ThisWorkbook.Worksheets(mitarbeiter(i).Cells(lastrow, lastrowcol)).Select 'crashes here
MsgBox mitarbeiter(i)
Next i
End Sub