Tengo una userform con un Toggle Button y no me funciona.
Private Sub CommandButton1_Click()
Sheets("userform").Select
'Range("A2:z50000").ClearContents
xrow = Range("lastrow").Row 'find the last row to
'find marital status
If opt_Married.Value = True Then
Cells(xrow, 4).Value = "Single"
Else
If opt_Divorced.Value = False Then
MsgBox ("You must select a marital status")
Exit Sub
Else
Cells(xrow, 4).Value = "Divorced"
End If
'Move data from the form to the worksheet
Cell(xrow, 1).Value = txt - Name.Value
Cell(xrow, 2).Value = combo_Feeling.Vaue
Cell(xrow, 3).Value = ListBox_Age.Value
Cell(xrow, 5).Value = chk_Empoyed.Value
Cell(xrow, 6).Value = spin_weight.Value
Cell(xrow, 7).Value = tooglebutton_OnOff.Caption
End Sub
Private Sub SpinButton1_Change()
txt_weight.Value = spin_weight.Value
End Sub
Private Sub ToggleButton_OnOff_Click()
If ToggleButton_OnOff.Value = True Then
'if the toogle is DEpress change caption to Model off
ToggleButton_OnOff.Caption = "Model Off"
Else
'if the toogle isUnpress change caption to off
ToggleButton_OnOff.Caption = "Model On"
End If
End Sub
Private Sub Userform_initialize()
Dim i As Integer
combo_Feeling.AddItem "I feel Good."
combo_Feeling.AddItem "I feel bad."
combo_Feeling.AddItem "Select"
combo_Feeling.Value = "Select" 'sets the value of the combobox
For i = 1 To 150
ListBox_Age.AddItem i
Next i
ListBox_Age.Value = 25
'set inital Value of option button
opt_Single.Value = True
'set initial Value of textbox for weight with
txt_weight.Value = spin_weight.Value
End Sub
Private Sub spin_weight_change()
txt_weight.Value = spin_weight.Value
End Sub
Puedo enviar el excel tambien
Me da como error que me falta el ibjeto. ¿Cómo puedoenviar el userform?