Bonjour,
Je bloque (comme d'hab ... ) sur une erreur ... erreur d'execution 9 sur cette ligne de code :
If Cells(2, i).Value = ThisWorkbook.Worksheets("closing").Range("A1") Then
Je ne comprends pas pourquoi ... vu que je suis une merde c'est normal ...
Pourriez-vous m'aider svp. Merci à vous.
Sub maj()
Dim nomfichier1 As String
Dim chemin1 As String
Dim wk1 As Workbook
Dim i As Byte
Dim dercolonne As Byte
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False
nomfichier1 = "Oscar 2018.xlsm" 'le fichier que je veux ouvrir
chemin1 = "R:\11 - Pilotage TU\00 Oscar\New OSCAR\" 'le chemin où il se trouve
Set wk1 = Workbooks.Open(chemin1 & nomfichier1)
Sheets("closing").Range("A2").Select
dercolonne = Cells(2, Cells.Columns.Count).End(xlToLeft).Column
'Sheets("closing").Range("A2").Select
For i = 1 To dercolonne
If Cells(2, i).Value = ThisWorkbook.Worksheets("closing").Range("A1") Then
Cells(2, i).Activate
End If
Next i
Range(ActiveCell, ActiveCell.End(xlDown)).Copy
Workbooks("OSCAR_2.xlsm").Worksheets("Feuil1").Range("B2").PasteSpecial Paste:=xlPasteValues
wk1.Close False
Application.AskToUpdateLinks = True
Application.DisplayAlerts = True
End Sub