PDA

View Full Version : Solved: simple question regarding OptionButton Controls



sunilmulay
11-15-2008, 04:24 AM
Hi Guys
I've got two controls set up in a sheet with the following code:

Private Sub OptionButton1_Click()
Dim intResponse As Integer

intResponse = MsgBox("You can toggle between the rates to view the effect on the Planning and Tracking modules. However, ensure you select the correct rate every time before posting any figures.", vbYesNo, "Toggle Rate?")

Select Case intResponse
Case vbYes
' Process commands.
Case vbNo
Exit Sub
End Select
Call UseCostOHDRates
End Sub
Private Sub OptionButton2_Click()
Dim intResponse As Integer

intResponse = MsgBox("You can toggle between the rates to view the effect on the Planning and Tracking modules. However, ensure you select the correct rate every time before posting any figures.", vbYesNo, "Toggle Rate?")

Select Case intResponse
Case vbYes
' Process commands.
Case vbNo
Exit Sub
End Select
Call UseCORs
End Sub

Once a user clicks on say Option 2, and the Dialog box pops up, if they select No, I want the selection to revert back to the Option 1 control. Currently, although the Sub is exited, the selection remains.....

Is this simple to fix?

Thanks
Sunil

Bob Phillips
11-15-2008, 05:04 AM
Private fReEntry As Boolean

Private Sub OptionButton1_Click()
Dim intResponse As Long

If Not fReEntry Then

fReEntry = True

intResponse = MsgBox("You can toggle between the rates to view the effect on the Planning and Tracking modules. However, ensure you select the correct rate every time before posting any figures.", vbYesNo, "Toggle Rate?")

Select Case intResponse
Case vbYes
' Process commands.
'Call UseCostOHDRates
Case vbNo
OptionButton2.Value = True
End Select

fReEntry = False
End If
End Sub

Private Sub OptionButton2_Click()
Dim intResponse As Long

If Not fReEntry Then

fReEntry = True

intResponse = MsgBox("You can toggle between the rates to view the effect on the Planning and Tracking modules. However, ensure you select the correct rate every time before posting any figures.", vbYesNo, "Toggle Rate?")

Select Case intResponse
Case vbYes
' Process commands.
'Call UseCORs
Case vbNo
OptionButton1.Value = True
End Select

fReEntry = False
End If
End Sub

sunilmulay
11-15-2008, 05:43 AM
many thanks!