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
| function recherche_cat_soc(col_cible As Integer, type_c1 As String, wbk_dcs As Workbook, wbk_input As Workbook, row_title As Integer)
Dim i As Integer, j As Integer
Dim tab_code As Range
If type_c1 = "vie" Then
Set tab_code = wbk_dcs.sheets(3).Range("A4:B10")
ElseIf type_c1 = "mixte" Then
Set tab_code = wbk_dcs.sheets(3).Range("A17:B23")
End If
j = 1
While Cells(row_title, j) <> "Catégorie / Mont" ' récupération de la colonne contenant catégorie / Mont
j = j + 1
Wend
i = 3
While wbk_input.ActiveSheet.Cells(i, j) <> ""
wbk_input.ActiveSheet.Cells(i, col_cible).Value = WorksheetFunction.VLookup(wbk_input.ActiveSheet.Cells(i, j).Value, tab_code, 2, False)
i = i + 1
Wend
End Function |