MerciC'est une fonction. Pour fixer le type, utiliser :
Function Derniere(Lig1 As Integer, Col1 As Integer, Lig2 As Integer, Col2 As Integer, Rien As Variant)
Tres Sympa Job75En VBA j'utiliserai cette fonction sans boucle :
Formule en N1 du fichier joint =DernierMois(3:10)VB:Function DernierMois(plage As Range) If plage.Rows.Count = 1 Then Exit Function Dim c As Range Set c = plage.Rows(2).Resize(plage.Rows.Count - 1).Find("*", , xlValues, , xlByColumns, xlPrevious) If Not c Is Nothing Then DernierMois = plage(1, c.Column - plage.Column + 1) End Function
ça fonctionne mais comment me limiter à la plage B3:M10 ? Encore merciEn VBA j'utiliserai cette fonction sans boucle :
Formule en N1 du fichier joint =DernierMois(3:10)VB:Function DernierMois(plage As Range) If plage.Rows.Count = 1 Then Exit Function Dim c As Range Set c = plage.Rows(2).Resize(plage.Rows.Count - 1).Find("*", , xlValues, , xlByColumns, xlPrevious) If Not c Is Nothing Then DernierMois = plage(1, c.Column - plage.Column + 1) End Function
Ok MerciEn N1 la formule =DernierMois(3:10) va très bien mais on peut aussi utiliser =DernierMois(B3:M10)