Option Compare Text 'la casse est ignorée
Sub Rapprochement()
Dim fichier As Variant, tablo, d As Object, i&, chambre$, dat$
fichier = Application.GetOpenFilename("Fichiers .xlsx (*.xlsx),*.xlsx")
If fichier = False Then Exit Sub
Application.ScreenUpdating = False
tablo = Workbooks.Open(fichier).Sheets(1).UsedRange.Columns(1) 'matrice, plus rapide
ActiveWorkbook.Close False
Set d = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(tablo)
If Left(Trim(tablo(i, 1)), 7) = "Chambre" Then
chambre = Trim(Replace(Replace(tablo(i, 1), "Chambre", ""), ":", ""))
If IsDate(tablo(i - 1, 1)) Then 'date sur la ligne précédente
dat = Format(tablo(i - 1, 1), "dd.mm.yy")
d(dat & chambre) = ""
End If
End If
Next i
With ActiveSheet.UsedRange
.Columns(14).ClearContents 'RAZ en colonne N
tablo = .Resize(, 14) 'matrice, plus rapide
For i = 2 To UBound(tablo)
chambre = tablo(i, 8)
If chambre <> "" Then If Not d.exists(tablo(i, 1) & chambre) And Not d.exists(tablo(i, 2) & chambre) _
Then tablo(i, 14) = "Pas trouvé" 'repère en colonne N
Next i
.Columns(14) = Application.Index(tablo, , 14) 'restitution
End With
End Sub