Userform Msg Box

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
583
I'm working with a User form that has eight option buttons and a text box. The user should only select one of the 8 option buttons after inserting text in the text box.

How can I get a message box to pop up if the user select an optionbutton and click OK before inserting text in the text box?

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Write a subroutine that is called by the first line of each button's routine. The subroutine would be something like:

Sub BtnCk()
If TextBox1 = Empty Then
put in your message box here
End if
End Sub

F.T.
 
Upvote 0
Hi, Im only a beginner myself but I think you would first set focus to the text box when the form opened and then disable all the option buttons until text was entered into the textbox. You would have to apply this to the change (or afterupdate) event on the textbox as well in case user blanked out the textbox info after previouly typing something in.

example
Private Sub UserForm_Activate()
TextBox1.setfocus
option1.enabled = false
option2.enabled = false
end sub

Private Sub TextBox1_AfterUpdate()
if TextBox1.value = ""
msgbox "You must enter a value in the textbox"
option1.enabled = false
option2.enabled = false
else
option1.enabled = true
option2.enabled = true
end if
end sub

Private Sub TextBox1_Change()
if TextBox1.value = ""
msgbox "You must enter a value in the textbox"
option1.enabled = false
option2.enabled = false
else
option1.enabled = true
option2.enabled = true
end if
end sub




_________________
cheers
Parry
This message was edited by parry on 2002-10-07 21:40
This message was edited by parry on 2002-10-07 21:41
This message was edited by parry on 2002-10-07 22:58
 
Upvote 0
Parry has a method that will work, although you should probably use the visible property rather than the enabled property.

F.T.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top