Hi,
I want to realise a programme with vlookup but the programme dis not working.
I want to realise a programme with vlookup but the programme dis not working.
Code:
Sub VLookup()
Dim sRes As String
Dim F1, F2 As Worksheet
Dim LastLig1 As Long
Dim plage As Range
Dim C As Range
Dim i As Integer
Dim rs As String
Dim Resultat As Range
Set F1 = Worksheets("fichier existant")
Set F2 = Worksheets("fichier importé")
Set plage = F2.Range("G1", F2.Range("G65536").End(xlUp))
'LastLig1 = F2.Cells(Rows.Count, "A").End(xlUp).Row
'For ligne = 2 To LastLig1
i = 1
For Each C In plage
i = i + 1
rs = F2.Range("G" + CStr(i)).Value
F2.Range("Z" + CStr(i)).Value = (Application.VLookup("rs", F1.Range("G:G"), 0, False))
If IsError(F2.Range("Z" + CStr(i)).Value) Then
F2.Range("Z" + CStr(i)).Value = old
Else
F2.Range("Z" + CStr(i)).Value = Nouveau
End If
Next C
'Debug.Print rs
End Sub