SAlut Ducl44, Vériland, Thomas, Ch'ti Minick
Pas encore fini ce fil !!! et dire que j'attends tes commentaire pour les ComboBox ...
Bon pour tous tes problèmes, voici le code complet du Private Module de Ton UserForm...
Option Explicit
Dim LeTexte As String
Private Sub UserForm_Initialize()
If ActiveCell <> "" Then RecoverCell
End Sub
Sub RecoverCell()
Dim Contenu
On Error Resume Next
Contenu = Split(ActiveCell.Value, Chr(10))
TextBox1 = Contenu(0)
TextBox2 = Contenu(1)
TextBox3 = Contenu(2)
End Sub
Private Sub CommandButton1_Click()
Dim Test As Byte
If TextBox1 <> "" Then Test = 1
If TextBox2 <> "" Then Test = 2
If TextBox3 <> "" Then Test = 3
Select Case Test
Case Is = 1: LeTexte = TextBox1
Case Is = 2: LeTexte = TextBox1 & vbCrLf & TextBox2
Case Is > 2: LeTexte = TextBox1 & vbCrLf & TextBox2 & vbCrLf & TextBox3
End Select
LeTexte = Application.WorksheetFunction.Substitute(LeTexte, vbCrLf, Chr(10))
ActiveCell.Value = LeTexte
AutoFiting
Unload UserForm1
End Sub
Sub AutoFiting()
Dim L1 As Byte, L2 As Byte, L3 As Byte, H As Single
L1 = Len(TextBox1)
L2 = Len(TextBox2)
L3 = Len(TextBox3)
If L1 > 0 Then H = 12.75
If L2 > 0 Then H = H + 12.75
If L3 > 0 Then H = H + 12.75
ActiveCell.RowHeight = H
End Sub
Private Sub CommandButton2_Click()
Unload UserForm1
End Sub
La macro AutoFiting est là pour le Fun avec une Méthode Len... mais en mettant la variable Test en Public on saurait déjà si les trois Textbox sont remplies....
Bonne Soirée
@+Thierry
PS La Fonction SPLIT utilisée ici, je crois, n'est pas valable sous XL 97