在用户窗体中更改选项按钮选择
Change Option Button selection in Userform
我创建了一个 vba 来更改用户窗体中的选项并部分成功。但是我无法更改选项按钮和复选框的数据。我在该行中收到一条 "False" 消息。请帮帮我!
Private Sub cmdupdate_Click()
If Me.cmbslno.Value = "" Then
MsgBox "SL No Can Not be Blank!", vbExclamation, "SL No"
Exit Sub
End If
SLNo = Me.cmbslno.Value Sheets("Data").Select
Dim rowselect As Double
rowselect = Me.cmbslno.Value
rowselect = rowselect + 3
Rows(rowselect).Select
Cells(rowselect, 2) = Me.TextEmpCode.Value
Cells(rowselect, 3) = Me.TextEmpName.Value
**Cells(rowselect, 5) = Me.Option1.Value
Cells(rowselect, 5) = Me.Option2.Value
Cells(rowselect, 5) = Me.Option3.Value**
Cells(rowselect, 17) = Me.TextBox1.Value
Cells(rowselect, 18) = Me.TextBox2.Value
Cells(rowselect, 19) = Me.TextBox3.Value
Cells(rowselect, 20) = Me.TextIncome.Value
End Sub
你能这样检查吗:
Cells(rowselect, 21) = Me.Option1.Value
Cells(rowselect, 22) = Me.Option2.Value
Cells(rowselect, 23) = Me.Option3.Value
第5
列给出了3次,每次都是重叠的。
您要在单元格中输入 "Option 1"、"Option 2" 还是 "Option 3"?
更改以下内容:
Cells(rowselect, 5) = Me.Option1.Value
Cells(rowselect, 5) = Me.Option2.Value
Cells(rowselect, 5) = Me.Option3.Value
到
Cells(rowselect, 5) = IIf(Me.Option1.Value, "Option 1", IIf(Me.Option2.Value, "Option 2", "Option 3"))
我创建了一个 vba 来更改用户窗体中的选项并部分成功。但是我无法更改选项按钮和复选框的数据。我在该行中收到一条 "False" 消息。请帮帮我!
Private Sub cmdupdate_Click()
If Me.cmbslno.Value = "" Then
MsgBox "SL No Can Not be Blank!", vbExclamation, "SL No"
Exit Sub
End If
SLNo = Me.cmbslno.Value Sheets("Data").Select
Dim rowselect As Double
rowselect = Me.cmbslno.Value
rowselect = rowselect + 3
Rows(rowselect).Select
Cells(rowselect, 2) = Me.TextEmpCode.Value
Cells(rowselect, 3) = Me.TextEmpName.Value
**Cells(rowselect, 5) = Me.Option1.Value
Cells(rowselect, 5) = Me.Option2.Value
Cells(rowselect, 5) = Me.Option3.Value**
Cells(rowselect, 17) = Me.TextBox1.Value
Cells(rowselect, 18) = Me.TextBox2.Value
Cells(rowselect, 19) = Me.TextBox3.Value
Cells(rowselect, 20) = Me.TextIncome.Value
End Sub
你能这样检查吗:
Cells(rowselect, 21) = Me.Option1.Value
Cells(rowselect, 22) = Me.Option2.Value
Cells(rowselect, 23) = Me.Option3.Value
第5
列给出了3次,每次都是重叠的。
您要在单元格中输入 "Option 1"、"Option 2" 还是 "Option 3"?
更改以下内容:
Cells(rowselect, 5) = Me.Option1.Value
Cells(rowselect, 5) = Me.Option2.Value
Cells(rowselect, 5) = Me.Option3.Value
到
Cells(rowselect, 5) = IIf(Me.Option1.Value, "Option 1", IIf(Me.Option2.Value, "Option 2", "Option 3"))