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
|
Function ColonneFeuille(ByVal FeuilleTitre As Worksheet, ByVal LigneTitre As Long, ByVal TitreRecherche As String) As Long
Dim NbColonnes As Long
Dim Cellule As Range, Aire As Range
With FeuilleTitre
ColonneFeuille = 0
NbColonnes = .Cells(LigneTitre, .Columns.Count).End(xlToLeft).Column
Set Aire = .Range(.Cells(LigneTitre, 1), .Cells(LigneTitre, NbColonnes))
For Each Cellule In Aire
Select Case Mid(Cellule.Value, 1, Len(TitreRecherche))
Case TitreRecherche
ColonneFeuille = Cellule.Column
Exit For
End Select
Next
If ColonneFeuille = 0 Then DetectionColonnes = DetectionColonnes & Chr(10) & TitreRecherche
Set Aire = Nothing
End With
End Function |
Partager