blocage du userform textbox
Bonjour à tous,
j'ai une erreur sûrement facile à déceler mais biensûr pas à mon niveau donc je fais appel à vous...
mon code bloc à ce niveau
Code:
Donrem = TextBox1.Text
dans le code complet :
Code:
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 29 30 31 32 33 34 35 36 37 38
| Sub Remisepro()
Worksheets("Devis").Protect userinterfaceonly:=True, AllowFormattingCells:=True
Dim Satisf As Boolean, Donrem As String, vrem As Integer
Dim lRem As Integer, Remi As Integer, lht As Integer
Dim Crit As Range
Dim Plage As Range
Dim ht As Single
Dim a As Range
Dim lAp As Integer
Const colht = 13
'Set Plage = Range("B23:B" & Range("B" & Rows.Count).End(xlUp).Row)
Set Plage = Range("A23:M" & Range("b" & Rows.Count).End(xlUp).Row)
ht = Application.WorksheetFunction.SumIf(Plage.Columns(2), "<>0", Plage.Columns(13))
On Error Resume Next
Set a = Application.InputBox("Sélectionnez une plage !", "Sélection de cellules", Type:=8)
On Error GoTo 0
U_remise.Show
Donrem = TextBox1.Text
vrem = CInt(Donrem)
If Not a Is Nothing Then
a.Value = "Remise professionnelle"
a.HorizontalAlignment = xlCenter
a.Font.FontStyle = "Bold Italic"
a.Select
ActiveCell.Offset(0, 5).Value = -ht * (vrem / 100)
lAp = a.Row
Cells(lAp, colht).NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
End If
End Sub |
je mets le code du userform U_Remise :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Function recdon() As Boolean
If TextBox1.Text = "" Then
MsgBox "Il manque des données"
Else: recdon = True
End If
End Function
Private Sub UserForm_Click()
Caption = "La remise est de " + CInt(Donrem) + "%"
End Sub
Private Sub TextBox1_Change()
Donrem = TextBox1.Text
End Sub
Private Sub U_OK_click()
If Not recdon Then Exit Sub
Satisf = True
Unload Me
End Sub
Private Sub U_Annul_click()
Satisf = False
Unload Me
End Sub |
Je ne comprends pourquoi la valeur de Donrem = "" alors que je rentre une valeur dans mon textbox1...
Si quelqu'un peut m'aider je serai super content. merci d'avance