Bonjour à vous !
Je viens de coder une macro qui me parait béton, cependant Excel essaye de communiquer avec moi depuis tout à l'heure avec l'erreur '-2147221080(800401a8)' Automation error
Et je ne comprends absolument pas ce qu'il me veut ?
Voici mon code en entier où j'indique quelle ligne est éronnée, si quelqu'un comprend ce qu'il essaye de me dire ?
Je viens de coder une macro qui me parait béton, cependant Excel essaye de communiquer avec moi depuis tout à l'heure avec l'erreur '-2147221080(800401a8)' Automation error
Et je ne comprends absolument pas ce qu'il me veut ?
Voici mon code en entier où j'indique quelle ligne est éronnée, si quelqu'un comprend ce qu'il essaye de me dire ?
Code:
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