Public Function Actualisation(ref As Variant) As Double
Dim stock As Workbook
Dim i As Integer
Dim flag As Boolean
Set stock = Application.Workbooks.Open("G:\stock.xls", True)
flag = False
i = 2
Actualisation = 0
Do Until flag
If Trim(ref) = Trim(stock.ActiveSheet.Cells(i, 1)) Then
flag = True
Actualisation = i
End If
i = i + 1
If stock.ActiveSheet.Cells(i, 1) = "" Then flag = True
Loop
End Function
'****************************************************************
Public Sub actu_stck()
Dim i As Integer
Dim j As Double
Dim flag As Boolean
Dim stock As Workbook
Dim PROJET_OCEAN As Workbook
Set stock = Application.Workbooks.Open("G:\stock.xls", True)
Set PROJET_OCEAN = ThisWorkbook
flag = False
i = 2
Do Until flag
j = Actualisation(Trim(PROJET_OCEAN.ActiveSheet.Cells(i, 1)))
If j <> 0 Then
'LA LIGNE ERRONNE EST CELLE QUI SUIT --------------------------------------------------------------'
PROJET_OCEAN.Sheets(Simulation).Cells(i, 10).Value = stock.Sheets(Informe1).Cells(j, 4).Value
End If
j = j + 1
i = i + 1
If PROJET_OCEAN.ActiveSheet.Cells(i, 1) = "" Then
flag = True
End If
Loop
End Sub