Bonjour à tous,
Je bloque sur ce code où j'ai une erreur au 1er IF.
Auriez-vous des idées pour la solution ?
Je ne pense pas être très loin mais je bloque.
Sub CopierColler()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Dim A, B, C As Worksheet
Set A = Worksheets("Actions Wolf+réduc impot revenu")
Set B = Worksheets("Simu Actions Wolf pour PAS")
Set C = ActiveSheet
If C.Name = A.Name Or B.Name Then
With Worksheets(C.Name)
Dim i As Integer, LastLigne As Integer, LigneEnCours As Integer
LastLigne = .Cells(41, 22).End(xlDown).Offset(1, 0).Row
LigneEnCours = LastLigne
For i = 1 To (LastLigne - 41)
If .Cells(40 + i, 27) <> .Cells(40 + i, 26) And .Cells(40 + i, 27) <> 0 And .Cells(40 + i, 30) <> "" Then
.Range(.Cells(40 + i, 22), .Cells(40 + i, 42)).Copy .Cells(LigneEnCours, 22)
Union(.Range(.Cells(LigneEnCours, 30), .Cells(LigneEnCours, 32)), .Cells(LigneEnCours, 34), .Cells(LigneEnCours, 40)) = ""
LigneEnCours = LigneEnCours + 1
End If
Next i
'Ajoutte dernière bordure en gras et la 1ère en normal
If .Cells(LigneEnCours - 1, 22) <> "" Then
.Range(.Cells(LastLigne, 22), .Cells(LastLigne, 42)).Borders.Item(xlEdgeTop).Weight = 2
.Range(.Cells(LigneEnCours - 1, 22), .Cells(LigneEnCours - 1, 42)).Borders.Item(xlEdgeBottom).Weight = -4138
End If
End With
End if
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Merci à tous.
A+
Wolf76