I would even lose the column search.
Function ENCUENTRASEM(takt As Double, wagon As String) As Double
Dim NumRows As Long, NumCols As Long
Dim col As Long, row As Long, x
NumRows = 370
NumCols = 148
col = -1
For row = 8 To NumRows
If Workbooks("SHM_170720_0300_TSH_CHU_Takt-Schedule_V049").Worksheets("3.TAKT SCHEDULE").Cells(row, 1).Value = takt Then
x = Application.Match(wagon, Workbooks("SHM_170720_0300_TSH_CHU_Takt-Schedule_V049").Worksheets("3.TAKT SCHEDULE").Cells(row, 5).Resize(, 148), 0)
If Not IsError(x) Then col = x + 4: Exit For
End If
Next row
ENCUENTRASEM = col
End Function
Bookmarks