Sicuramente access sarebbe più veloce, nel caso, però, che vuoi usare ancora excel prova questo codice. Manca la conversione in giorno giuliano ma per il resto dovrebbe fare abbastanza al caso tuo. Nel caso dagli tu un'aggiustatina qua e la.
codice:
Option Explicit
'> "fI" = foglio Input
'> "ws" = array delle stazioni selezionate
'> "fO" = foglio Output
Public Sub routine()
Dim rigaInput As Integer
Dim rigaOutput As Integer, colonnaOutput As Integer
Dim c As Range, c2 As Range
'> Creo un array con referenza delle stazioni selezionate.
Dim ws() As Worksheet, ixWS As Integer
ixWS = 0
For rigaInput = 2 To fI.Cells(fI.Rows.Count, 2).End(xlUp).Row
ReDim Preserve ws(ixWS)
Set ws(ixWS) = ThisWorkbook.Worksheets(Trim(fI.Cells(rigaInput, 2)))
ixWS = ixWS + 1
Next rigaInput
'> ... for debug ...
For ixWS = LBound(ws) To UBound(ws)
Debug.Print "stazione selezionata: " & ws(ixWS).Name
Next ixWS
'> Adesso ciclo per le date creando il foglio di output.
rigaOutput = 1
fO.Cells.Delete '> cancella il contenuto del foglio di output prima di iniziare
For rigaInput = 2 To fI.Cells(fI.Rows.Count, 1).End(xlUp).Row
fO.Cells(rigaOutput, 1) = Format(fI.Cells(rigaInput, 1), "dd/mm/yyyy hh:mm:ss")
rigaOutput = rigaOutput + 1
'> Ciclo per le stazioni selezionate.
For ixWS = LBound(ws) To UBound(ws)
'>Ciclo per la colonna 1 della stazione corrente.
For Each c In ws(ixWS).Range(ws(ixWS).Cells(1, 1), ws(ixWS).Cells(ws(ixWS).Cells(fI.Rows.Count, 2).End(xlUp).Row, 1))
If Format(fI.Cells(rigaInput, 1), "dd/mm/yyyy hh:mm:ss") = Format(c.Value, "dd/mm/yyyy hh:mm:ss") Then
'>Ho trovato la data corrispondente.
colonnaOutput = 1
For Each c2 In ws(ixWS).Range(ws(ixWS).Cells(c.Row, 2), ws(ixWS).Cells(c.Row, ws(ixWS).Cells(c.Row, ws(ixWS).Columns.Count).End(xlToLeft).Column))
fO.Cells(rigaOutput, colonnaOutput) = c2.Value
colonnaOutput = colonnaOutput + 1
Next c2
rigaOutput = rigaOutput + 1
End If
Next c
Next ixWS
Next rigaInput
End Sub
[ot] Per quanto riguarda il cobol mi ero illuso; e invece: ancora solooooooooo
[/ot]