我试图得到这个结果:
目前我的 vbc 脚本给了我这个:
这是 vlookup 的第一张表
Sub Suivi()
With ActiveSheet
.Unprotect Password:="capreit"
Rows("2:" & Rows.Count).ClearContents
Worksheets("Suivi Déménagement").Cells.Borders.LineStyle = xlNone
Dim i As Integer
j = 2
For i = 4 To Sheets("Tableau").Range("A4").SpecialCells(xlLastCell).Row
If Sheets("Tableau").Cells(i, 2).Value = "Nouveau locataire" Or Sheets("Tableau").Cells(i, 2).Value = "Décès" Or Sheets("Tableau").Cells(i, 2).Value = "Skip" And Evaluate("OR(ISNUMBER(MATCH({""*-*""},{""" & Sheets("Tableau").Cells(i, 1).Value & """},0)))") Then
Sheets("Suivi Déménagement").Cells(j, 1) = Sheets("Tableau").Cells(i, 1)
Sheets("Suivi Déménagement").Cells(j, 2).Formula = "=IFERROR(VLookup($A2,Tableau!$A:$T,4,FALSE),"""")"
Sheets("Suivi Déménagement").Cells(j, 3).Formula = "=IFERROR(VLookup($A2,Tableau!$A:$T,3,FALSE),"""")"
Sheets("Suivi Déménagement").Cells(j, 4).Formula = "=IFERROR(VLookup($A2,Tableau!$A:$T,2,FALSE),"""")"
Sheets("Suivi Déménagement").Cells(j, 5).Formula = "=IFERROR(VLookup($A2,Tableau!$A:$T,18,FALSE),"""")"
Sheets("Suivi Déménagement").Cells(j, 6).Formula = "=IFERROR(VLookup($A2,Tableau!$A:$T,19,FALSE),"""")"
j = j + 1
End If
Next i