bonsoir
j'ai clos mon sujet un peu tot, casefere a repondu et a rajouter ce code.
qui fonctionne, mais je ne sais pas comment l'integrer dans le mien.
voici le code:
et voici le mien: bonsoirCode:
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
28 Private Sub CommandButton1_Click() Dim es, x As Integer, ch As String, lg As Integer, y As Integer, result(), z As Integer Dim lgcar As Integer TextBox1 = "si on m'appelle alphonse, ce n'est pas mon vrai nom mais simplement un pseudo" lg = 15 es = Split(UserForm1.TextBox1, " ") ReDim Preserve result(x) y = UBound(es) z = 1 ch = "" result(x) = es(0) ch = es(0) lgcar = 0 For x = 0 To y ReDim Preserve result(x) While Len(result(x)) < lg + 1 And z <= UBound(es) ch = ch & " " & es(z) result(x) = ch z = z + 1 Wend ch = "" If z > UBound(es) Then Exit For Next x TextBox1.Text = result(0) For x = 1 To UBound(result) TextBox1 = TextBox1 & Chr(10) & result(x) Next x End Sub
le code fonctionne bien et reponds a ma demande.
mais le texbox est deja pre rempli,
je souhaiterais le remplir moi meme.
comment je peux integrer ton code dans le mien ci dessous.
Car apres j'utilise une macro ou je recupere le commentaire et je le sauvegarde sous pdf.Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 Private Sub CB_Valid_Click() Dim WsS As Worksheet Dim MaRech As Range, MaPlage As Range Dim DerLigS As Long, DerCol As Long Set WsS = Sheets("Data") DerLigS = WsS.Cells(Columns(1).Cells.Count, 1).End(xlUp).Row Set MaPlage = WsS.Range(WsS.Cells(1, 1), WsS.Cells(DerLigS, 1)) Set MaRech = MaPlage.Find(UF_Saisie.CB_numero, LookIn:=xlValues) DerCol = WsS.Cells(MaRech.Row, WsS.Rows(MaRech.Row).Cells.Count).End(xlToLeft).Column WsS.Cells(MaRech.Row, DerCol + 1) = CDate(DTPicker2) 'UF_Saisie.TB_Date) With WsS.Cells(MaRech.Row, DerCol + 1) .AddComment .Comment.Visible = False .Comment.Text Text:=UF_Saisie.TB_Comment.Value End With UF_Saisie.Hide Unload UF_Saisie End Sub