Option Explicit
Option Base 1
Sub TheRecoder()
Dim WSSource As Worksheet
Dim RangeSource As Range, RangeCible As Range
Dim TabSource As Variant, TabCible As Variant
Dim TabloSource() As String, TabloCible() As String
Dim i As Integer, ii As Integer, iii As Integer
Dim NRow As Integer, NCol As Integer
Set WSSource = ThisWorkbook.Worksheets("Codes")
With WSSource
Set RangeSource = Range(.Range("A3"), .Range("B5000").End(xlUp))
End With
Set RangeCible = Application.InputBox(prompt:="Selectionner la Plage Planning", Type:=8)
TabSource = RangeSource
TabCible = RangeCible
For i = 1 To UBound(TabSource)
ReDim Preserve TabloSource(1 To UBound(TabSource), 2)
TabloSource(i, 1) = TabSource(i, 1)
TabloSource(i, 2) = TabSource(i, 2)
Next i
NRow = RangeCible.Rows.Count
NCol = RangeCible.Columns.Count
For i = 1 To NRow
For ii = 1 To NCol
ReDim Preserve TabloCible(1 To NRow, 1 To NCol)
TabloCible(i, ii) = TabCible(i, ii)
For iii = 1 To UBound(TabSource)
If TabloCible(i, ii) = TabSource(iii, 1) Then
TabloCible(i, ii) = TabSource(iii, 2)
Exit For
End If
Next iii
Next ii
Next i
RangeCible = TabloCible
End Sub