Potrzebowałem użyć tej metody ponieważ nie chciałem wykonywać pętli z racji dużej ilości rekordów. Dodatkowo problemem był dziwny format danych i metoda MATCH nie odnajdywała szukanej wartości.
Potrzebny kod znalazłem na tej stronie: https://stackoverflow.com/questions/32190029/excel-vba-find-row-number-of-matching-value.
Dim MissThisItem Dim ItemRowCounter as Long Public ItemArray(0) as Variant Private Sub CheckItem With ThisWorkbook.Sheets("SheetName") Do Until .Cells(x, y) = "" MissThisItem = SearchFlag_in_Range() If MissThisItem = 0 Then ItemArray(0) = .Cells(ItemRowCounter, y) Exit Do End If ItemRowCounter = ItemRowCounter + 1 Loop End with ' paste rest code here End Sub Private Function SearchFlag_in_Harmonogram() ' https://stackoverflow.com/questions/32190029/excel-vba-find-row-number-of-matching-value ' Search if Item might be used, "X" in range means it should be stopped. With ThisWorkbook.Sheets("SheetName") Set FoundCell = .Range(Cells(ItemRowCounter, y), Cells(ItemRowCounter, z)).Find(What:="X") If Not FoundCell Is Nothing Then SearchFlag_in_Harmonogram = FoundCell.Column End If End With End Function