Sub kaoshi(i As Integer)
With Sheet2
'清空4个选项
.OptionButton1.Value = False
.OptionButton2.Value = False
.OptionButton3.Value = False
.OptionButton4.Value = False
'写入题目
.Label2.Caption = i
.Label3.Caption = Sheet3.Range("a" & i + 1)
.Label4.Caption = Sheet3.Range("b" & i + 1)
.Label5.Caption = Sheet3.Range("c" & i + 1)
.Label6.Caption = Sheet3.Range("d" & i + 1)
.Label7.Caption = Sheet3.Range("e" & i + 1)
'该隐藏的隐藏
If .Label6.Caption = "" Then
.OptionButton3.Visible = False
Else
.OptionButton3.Visible = True
End If
If .Label6.Caption = "" Then
.OptionButton4.Visible = False
Else
.OptionButton4.Visible = True
End If
'返回之前的答案
If Sheet3.Range("g" & i + 1) = "A" Then
.OptionButton1.Value = True
ElseIf Sheet3.Range("g" & i + 1) = "B" Then
.OptionButton1.Value = True
ElseIf Sheet3.Range("g" & i + 1) = "C" Then
.OptionButton1.Value = True
ElseIf Sheet3.Range("g" & i + 1) = "D" Then
.OptionButton1.Value = True
End If
End With
End Sub
Private Sub CommandButton1_Click()
Call kaoshi(1)
Sheet2.SpinButton1.Value = 1
End Sub
Private Sub CommandButton2_Click()
Call kaoshi(8)
Sheet2.SpinButton1.Value = 8
End Sub
Private Sub OptionButton1_Click()
Sheet3.Range("g" & Sheet2.SpinButton1.Value + 1) = "A"
End Sub
Private Sub OptionButton2_Click()
Sheet3.Range("g" & Sheet2.SpinButton1.Value + 1) = "B"
End Sub
Private Sub OptionButton3_Click()
Sheet3.Range("g" & Sheet2.SpinButton1.Value + 1) = "C"
End Sub
Private Sub OptionButton4_Click()
Sheet3.Range("g" & Sheet2.SpinButton1.Value + 1) = "D"
End Sub
Private Sub SpinButton1_Change()
Call kaoshi(Sheet2.SpinButton1.Value)
End Sub