Hi everyone!
I just created a FUNCTION to find the column number of a cell in other BOOK depending of two variables. For 100 cells it takes 3 minutes to calculate!
THIS IS MY CODE:
Option Explicit
Function ENCUENTRASEM(takt As Double, wagon As String) As Double
Dim col As Integer
Dim row As Integer
Dim res As Integer
Dim NumRows As Integer
Dim NumCols As Integer
NumRows = 370
NumCols = 148
res = -1
For row = 8 To NumRows
For col = 5 To NumCols
If Application.Workbooks("SHM_170720_0300_TSH_CHU_Takt-Schedule_V049").Worksheets("3.TAKT SCHEDULE").Cells(row, col).Value = wagon And Application.Workbooks("SHM_170720_0300_TSH_CHU_Takt-Schedule_V049").Worksheets("3.TAKT SCHEDULE").Cells(row, 1).Value = takt Then
res = col
Exit For
End If
Next col
If res <> -1 Then
Exit For
End If
Next row
ENCUENTRASEM = res
End Function
Bookmarks