I wrote VBA code that opens Workbooks located on the Server to copy data.
I have one PC where it says "subscript out of range".
It opens the workbook but can't find the sheet.
Network location is mapped on both PC under the same name.
For looks for the Column with Date -1 and set i for coordinates.
Later While is checking if the Cell is without Fill as coloured cell is irrelevant. If so it moves on cell left as long as it finds Cell that is not filled.
Sub importData()
Dim sht As String
Dim i As Integer
sht = Cstr(Date - 1)
Dim Temp(1 To 38) As String
For i = 4 To 42
If Cells(3, i).Value = sht Then
Exit For
End If
Next i
While Cells(2, i).Interior.ColorIndex <> xlColorIndexNone
i = i - 1
sht = Cells(3, i).Value
Wend
Workbooks.Open "path to file & filename.xlsm"
Workbooks("filename").Worksheets(sht)