oasis_1
XLDnaute Occasionnel
Bonjour le Forum,
j'utilise une userform pour modifier si il y a besoin un tableau.
le tableau étant trop lourd ci joint les formules vba
Private Sub TextBox4_Change()
TextBox4 = Format(TextBox4.Value, " 0 000.00 " & " €")
End Sub
Private Sub TextBox5_Change()
TextBox5 = Format(TextBox5.Value, " 0 000.00 " & " €")
End Sub
Private Sub TextBox6_Change()
TextBox6 = Format(TextBox6.Value, " 000.00 " & " €")
End Sub
pour que les textbox affiche en €
puis la validation pour enregistrer :
Private Sub Enregistré_Click() 'Bibliothèque
Dim Nb As Integer, Dnb As Integer, i As Integer, Y As String
Dim Element_Select As String
Dnb = Sheets("Semaine").Range("w2").Value
Nb = UserForm18.ListBox1.ListCount
Element_Select = False
Sheets("Semaine").Activate
' TextBox = Format(TextBox.Value, " 0.00 €")
Y = 4 'Sur Feuil2 ligne de départ de la bibli ----> "A3"
'----------- MODIFICATION DES DONNEES EN BIBLI ----------
For i = 0 To Nb - 1
If UserForm18.ListBox1.Selected(i) = True Then
Element_Select = True
Range("b" & i + Y).Value = TextBox2
Range("c" & i + Y).Value = TextBox3
Range("d" & i + Y).Value = TextBox4
Range("e" & i + Y).Value = TextBox5
Range("f" & i + Y).Value = TextBox6
With Range("f" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
With .Font
' .Size = 10
' .Italic = False
'.Bold = False
' .Name = "Arial"
End With
End With
End If
Next
If Element_Select = True Then
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = False
TextBox2 = Clear
TextBox3 = Clear
TextBox4 = Clear
TextBox5 = Clear
TextBox6 = Clear
Next i
End If
'------------- AJOUT DE DONNEES EN BIBLI ----------------
If Element_Select = False Then
Range("b" & Dnb + Y).Value = TextBox2
Range("c" & Dnb + Y).Value = TextBox3
Range("d" & Dnb + Y).Value = TextBox4
Range("e" & Dnb + Y).Value = TextBox5
Range("f" & Dnb + Y).Value = TextBox6
With Range("f" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
End With
Dnb = Dnb + 2
ElseIf TextBox2 = "" Then
Dnb = Dnb - 1
For J = 0 To Nb + 4
If "" = Range("b" & J + Y).Value Then 'supprime ligne vide
Range("b" & J + Y).Select
For X = -1 To 2
Range("b" & J + Y).Offset(0, X) = Range("b" & J + Y).Offset(1, X).Value
Range("b" & J + Y).Offset(1, X).Value = Clear
Next
End If
Next
Else
End If
TextBox2 = Clear
TextBox3 = Clear
TextBox4 = Clear
TextBox5 = Clear
TextBox6 = Clear
Call box1
Dnb = Sheets("Semaine").Range("w2").Value
' UserForm1.Label7.Caption = "Quantité Données Bibliothèque : " & dnb
ActiveWorkbook.Save
Sheets("Semaine").Protect
End Sub
Seulement pas tres pratique et je souhaiterai pouvoir intégrer directement dans Private Sub Enregistré .
pour qu'au final en validant les textbox 4,5 et 6 s'affiche sur ma feuille au bon format
merci par avance
j'utilise une userform pour modifier si il y a besoin un tableau.
le tableau étant trop lourd ci joint les formules vba
Private Sub TextBox4_Change()
TextBox4 = Format(TextBox4.Value, " 0 000.00 " & " €")
End Sub
Private Sub TextBox5_Change()
TextBox5 = Format(TextBox5.Value, " 0 000.00 " & " €")
End Sub
Private Sub TextBox6_Change()
TextBox6 = Format(TextBox6.Value, " 000.00 " & " €")
End Sub
pour que les textbox affiche en €
puis la validation pour enregistrer :
Private Sub Enregistré_Click() 'Bibliothèque
Dim Nb As Integer, Dnb As Integer, i As Integer, Y As String
Dim Element_Select As String
Dnb = Sheets("Semaine").Range("w2").Value
Nb = UserForm18.ListBox1.ListCount
Element_Select = False
Sheets("Semaine").Activate
' TextBox = Format(TextBox.Value, " 0.00 €")
Y = 4 'Sur Feuil2 ligne de départ de la bibli ----> "A3"
'----------- MODIFICATION DES DONNEES EN BIBLI ----------
For i = 0 To Nb - 1
If UserForm18.ListBox1.Selected(i) = True Then
Element_Select = True
Range("b" & i + Y).Value = TextBox2
Range("c" & i + Y).Value = TextBox3
Range("d" & i + Y).Value = TextBox4
Range("e" & i + Y).Value = TextBox5
Range("f" & i + Y).Value = TextBox6
With Range("f" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
With .Font
' .Size = 10
' .Italic = False
'.Bold = False
' .Name = "Arial"
End With
End With
End If
Next
If Element_Select = True Then
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = False
TextBox2 = Clear
TextBox3 = Clear
TextBox4 = Clear
TextBox5 = Clear
TextBox6 = Clear
Next i
End If
'------------- AJOUT DE DONNEES EN BIBLI ----------------
If Element_Select = False Then
Range("b" & Dnb + Y).Value = TextBox2
Range("c" & Dnb + Y).Value = TextBox3
Range("d" & Dnb + Y).Value = TextBox4
Range("e" & Dnb + Y).Value = TextBox5
Range("f" & Dnb + Y).Value = TextBox6
With Range("f" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
End With
Dnb = Dnb + 2
ElseIf TextBox2 = "" Then
Dnb = Dnb - 1
For J = 0 To Nb + 4
If "" = Range("b" & J + Y).Value Then 'supprime ligne vide
Range("b" & J + Y).Select
For X = -1 To 2
Range("b" & J + Y).Offset(0, X) = Range("b" & J + Y).Offset(1, X).Value
Range("b" & J + Y).Offset(1, X).Value = Clear
Next
End If
Next
Else
End If
TextBox2 = Clear
TextBox3 = Clear
TextBox4 = Clear
TextBox5 = Clear
TextBox6 = Clear
Call box1
Dnb = Sheets("Semaine").Range("w2").Value
' UserForm1.Label7.Caption = "Quantité Données Bibliothèque : " & dnb
ActiveWorkbook.Save
Sheets("Semaine").Protect
End Sub
Seulement pas tres pratique et je souhaiterai pouvoir intégrer directement dans Private Sub Enregistré .
pour qu'au final en validant les textbox 4,5 et 6 s'affiche sur ma feuille au bon format
merci par avance