Bonjour tout le monde. J'ai besoin d'aide s'il vous plaît j'ai un projet a rendre dans 3 jours je suis coincé
il s'agit d'une petite application utilisateur qui calculera la taille de la position (nombre d'actions) en fonction du risque que vous définissez (êtes prêt à prendre) par rapport à votre capital commercial.
J'ai un code, cependant j'ai un message d'erreur me disant " Erreur de compilation Variable non définie" en me soulignent
Voici le code vous trouverez ainsi mon fichier Merci d'avance :
Option Explicit
Private Sub cmdCalculate_Click()
Dim ws As Worksheet
Set ws = Sheet1
Dim c As Control
For Each c In Me.Frame1.Controls
If TypeName(c) = "TextBox" Then
If c = vbNullString Then
ShowErr c
Exit Sub
End If
End If
Next
ws.Range("D7").Value = Me.txtFunds
ws.Range("E7").Value = Me.txtPrice
ws.Range("F7").Value = Me.txtStop
ws.Range("G7").Value = Me.txtBroker
ws.Range("H7").Value = Me.txtRisk
Me.txtRisk2.Value = ws.Range("J7").Value
Me.txtUnits.Value = Format(ws.Range("I7").Value, "#,##0")
Me.txtParcel.Value = Format(ws.Range("K7").Value, "Currency")
End Sub
Private Sub ShowErr(c As Control)
MsgBox "Textbox " & c.Name & " cannot be empty!"
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdReset_Click()
Unload Me
frmRisk.Show
End Sub
Private Sub Frame1_Click()
End Sub
Private Sub txtBroker_AfterUpdate()
Me.txtBroker = Format(Me.txtBroker, "Currency")
End Sub
Private Sub txtFunds_AfterUpdate()
Me.txtFunds = Format(Me.txtFunds, "Currency")
End Sub
Private Sub txtPrice_AfterUpdate()
Me.txtPrice = Format(Me.txtPrice, "Currency")
End Sub
Private Sub txtStop_AfterUpdate()
Me.txtStop = Format(Me.txtStop, "Currency")
End Sub
Private Sub UserForm_Click()
End Sub