1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| 'Open the directory "S:" to be able to find the correct report
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "S:"
.Show
'and select the report on which you click
If .SelectedItems.Count > 0 Then Workbooks.Open (.SelectedItems(1))
End With
str = ActiveWorkbook.Name
With ThisWorkbook.Worksheets("S i")
For i = 0 To .Columns(.Range("BR3").Column).Find("*", , , , xlByColumns, xlPrevious).Row - 1
If WorksheetFunction.CountIf(Workbooks(str).Worksheets("Donnees").Range("C1:C100"), (.Range("BS3").Offset(i, -69) = "h s")) Then
.Range("BS3").Offset(i, 0) = WorksheetFunction.VLookup(.Range("BS3").Offset(i, -70), Workbooks(str).Worksheets("Donnees").Range("C15:C16"), 2, False) / 1000000
Else
'rien
End If
Next i
End With |