Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default radio button help


Hi All,

I have designed a user form in excel with radio buttons. I am trying to make
those radio buttons mandatory. Here is my code, But it doesnt work!
What happens is, If user forgets to select a radio button it pops a message
asking to select one, Once I click OK on the msgbox and then select a radio
button , It still displays the same message.

' Fee Radio button: Yes
If FeeYes.Value = True Then
ws.Cells(iRow, 17).Value = "Yes"
End If

' Fee Radio button: No
If FeeNo.Value = True Then
ws.Cells(iRow, 17).Value = "No"
End If

'check if a values is selected for Fee
If FeeYes.Value = False & FeeNo.Value = False Then
MsgBox "Please select if Fee is Reimbursed or not"
Exit Sub
End If

Please Help.



Thanks in Advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default radio button help

AND instead of &

If FeeYes.Value = False AND FeeNo.Value = False Then
MsgBox "Please select if Fee is Reimbursed or not"
Exit Sub
End If

If this post helps click Yes
---------------
Jacob Skaria


"sam" wrote:

Hi All,

I have designed a user form in excel with radio buttons. I am trying to make
those radio buttons mandatory. Here is my code, But it doesnt work!
What happens is, If user forgets to select a radio button it pops a message
asking to select one, Once I click OK on the msgbox and then select a radio
button , It still displays the same message.

' Fee Radio button: Yes
If FeeYes.Value = True Then
ws.Cells(iRow, 17).Value = "Yes"
End If

' Fee Radio button: No
If FeeNo.Value = True Then
ws.Cells(iRow, 17).Value = "No"
End If

'check if a values is selected for Fee
If FeeYes.Value = False & FeeNo.Value = False Then
MsgBox "Please select if Fee is Reimbursed or not"
Exit Sub
End If

Please Help.



Thanks in Advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default radio button help


Hi

You are very close, replace the '&' sign with the 'And' operator:

If FeeYes.Value = False And FeeNo.Value = False Then

Best regards,
Per

"sam" skrev i meddelelsen
...
Hi All,

I have designed a user form in excel with radio buttons. I am trying to
make
those radio buttons mandatory. Here is my code, But it doesnt work!
What happens is, If user forgets to select a radio button it pops a
message
asking to select one, Once I click OK on the msgbox and then select a
radio
button , It still displays the same message.

' Fee Radio button: Yes
If FeeYes.Value = True Then
ws.Cells(iRow, 17).Value = "Yes"
End If

' Fee Radio button: No
If FeeNo.Value = True Then
ws.Cells(iRow, 17).Value = "No"
End If

'check if a values is selected for Fee
If FeeYes.Value = False & FeeNo.Value = False Then
MsgBox "Please select if Fee is Reimbursed or not"
Exit Sub
End If

Please Help.



Thanks in Advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default radio button help


Just another thought...

If you're only allowing two choices for this option, you may want to replace the
pair of optionbuttons with a single checkbox (nicely labeled).

If you have multiple choices for this, you could always preselect (in the
userform_initialize procedure) the optionbutton that is used the most.

In either case, you'll know something was chosen--even if it was by default.

sam wrote:

Hi All,

I have designed a user form in excel with radio buttons. I am trying to make
those radio buttons mandatory. Here is my code, But it doesnt work!
What happens is, If user forgets to select a radio button it pops a message
asking to select one, Once I click OK on the msgbox and then select a radio
button , It still displays the same message.

' Fee Radio button: Yes
If FeeYes.Value = True Then
ws.Cells(iRow, 17).Value = "Yes"
End If

' Fee Radio button: No
If FeeNo.Value = True Then
ws.Cells(iRow, 17).Value = "No"
End If

'check if a values is selected for Fee
If FeeYes.Value = False & FeeNo.Value = False Then
MsgBox "Please select if Fee is Reimbursed or not"
Exit Sub
End If

Please Help.

Thanks in Advance.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio Button zak Excel Programming 5 January 11th 09 09:40 PM
Help with radio button Diana Excel Discussion (Misc queries) 1 July 17th 06 09:29 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM
Radio Button Powlaz Excel Programming 1 August 5th 04 03:03 AM


All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"