1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Option Explicit
Sub RecupererLesCommentairesDansTab2(ByVal AireTableau1 As Range, ByVal AireTableau2 As Range)
Dim CelluleTableau1 As Range, CelluleTableau2 As Range
For Each CelluleTableau2 In AireTableau2
For Each CelluleTableau1 In AireTableau1
If CelluleTableau1 & CelluleTableau1.Offset(0, 2) = CelluleTableau2 & CelluleTableau2.Offset(0, 2) Then
CelluleTableau2.Offset(0, 10) = CelluleTableau1.Offset(0, 10)
End If
Next CelluleTableau1
Next CelluleTableau2
End Sub
Sub LancerRecupererLesCommentairesDansTab2()
Dim ZoneTab1 As Range, ZoneTab2 As Range
Dim LigneTitreTab1 As Long, DerniereLigneTab1 As Long, LigneTitreTab2 As Long, DerniereLigneTab2 As Long
On Error GoTo Fin
With Sheets("Source Tab1")
LigneTitreTab1 = 1
DerniereLigneTab1 = .UsedRange.SpecialCells(xlCellTypeLastCell).Row
Set ZoneTab1 = .Range(.Cells(LigneTitreTab1 + 1, 1), .Cells(DerniereLigneTab1, 1))
End With
With Sheets("Cible Tab2")
LigneTitreTab2 = 1
DerniereLigneTab2 = .UsedRange.SpecialCells(xlCellTypeLastCell).Row
Set ZoneTab2 = .Range(.Cells(LigneTitreTab2 + 1, 1), .Cells(DerniereLigneTab2, 1))
End With
RecupererLesCommentairesDansTab2 ZoneTab1, ZoneTab2
GoTo Fin
Fin:
Set ZoneTab1 = Nothing
Set ZoneTab2 = Nothing
End Sub |
Partager