OptionButton , Option Button ,OptionButton In VBA Excel, VBA (User Form) Beginner , userform, excel,

Опубликовано: 28 Сентябрь 2024
на канале: MANOJ KUMAR EXCEL
2,005
42

OptionButton , Option Button ,OptionButton In VBA Excel, VBA (User Form) Beginner , userform, excel, Microsoft Excel,
VBA Userform part-3,

**************VBA CODE************************
Private Sub CommandButton1_Click()

Dim irow As Long

irow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row + 1
With Sheet1
.Range("A" & irow).Value = Me.TextBox1.Value

''GENDER

If Me.OptionButton1.Value Then .Range("B" & irow).Value = "MALE"
If Me.OptionButton2.Value Then .Range("B" & irow).Value = "FEMALE"
If Me.OptionButton3.Value Then .Range("B" & irow).Value = "UNKNOWS"


'''MARITAL STATUS

If Me.OptionButton4.Value Then .Range("C" & irow).Value = "SINGL"
If Me.OptionButton5.Value Then .Range("C" & irow).Value = "MARRIED"
If Me.OptionButton6.Value Then .Range("C" & irow).Value = "OTHER"

End With


'RESET THE CONTROL ATER ENTERING

Me.TextBox1.Value = ""
Me.OptionButton1.Value = False
Me.OptionButton2.Value = False
Me.OptionButton3.Value = False
Me.OptionButton4.Value = False
Me.OptionButton5.Value = False
Me.OptionButton6.Value = False

MsgBox " DATA ENTERED SUCCESSFULLY!!"




End Sub


BY@MANOJ KUMAR FROM BHORHA, SIMRI BAKHTIYARPUR,SAHARSA, BIHAR,