Re : hauteur de ligne ajustable
bonsoir le forum,
bonsoir pierrejean,
hier lorsque j'ai commencé un nouveau post :
https://www.excel-downloads.com/threads/ajustement-de-la-hauteur-dune-zone-pour-impression.136902/ , un participant m'a donné l'adresse de celui-ci, et, bêtement j'ai répondu à ce participant sur ce post au lieu du mien. désolé !!
mais depuis hier j'ai bien avancé, et cela donne cette macro que j'adapte à mon énorme classeur.
Sub Ajustement()
Dim i, HauteurTotaleLigne
Fact.Range("a18:f46").Rows.AutoFit
HauteurTotaleLigne = Fact.Range(Rows(18), Rows(46)).Height
If HauteurTotaleLigne > 415 Or HauteurTotaleLigne < 410 Then
For i = Fact.Range("B47").End(xlUp).Row + 1 To 46 'To 18 Step -1
If Fact.Range(Rows(18), Rows(46)).Height < 410 Then
If Fact.Range("B" & i) = "" Then Rows(i).RowHeight = 20
If Fact.Range(Rows(18), Rows(46)).Height > 410 Then Exit For
End If
If Fact.Range(Rows(18), Rows(46)).Height > 415 Then
If Fact.Range("B" & i) = "" Then Rows(i).RowHeight = 2
If i = 46 Then
MsgBox (ok)
End If
If Fact.Range(Rows(18), Rows(46)).Height < 415 Then Exit For
End If
Next
End If
End Sub
merci pour ton classeur qui sera certainement une source d'inspiration.
ps: n'hésite pas à visiter mon post pour avoir le classeur et le but de ma requête.