![]() |
Selection of UserForm through button
Hi All, I have this code working for selecting a userform: Private Sub CommandButton1_Click() If Button = OptionButton1 Then UserForm1.Show ElseIf Button = OptionButton2 Then UserForm2.Show End If End Sub Now I want to add a 3rd. button. I tried inserting another if statement but it does not show my new user form. Any help would be apreicated Thanks Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=492924 |
Selection of UserForm through button
Can you post the code that is not working?
Alok "saziz" wrote: Hi All, I have this code working for selecting a userform: Private Sub CommandButton1_Click() If Button = OptionButton1 Then UserForm1.Show ElseIf Button = OptionButton2 Then UserForm2.Show End If End Sub Now I want to add a 3rd. button. I tried inserting another if statement but it does not show my new user form. Any help would be apreicated Thanks Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=492924 |
Selection of UserForm through button
Hi alok, Here is the code: Private Sub CommandButton1_Click() If Button = OptionButton1 Then UserForm1.Show End If If Button = OptionButton2 Then UserForm2.Show End If If Button = optionbutton4 Then UserForm4.Show End If End Sub What is happening is when I select a button, it shows all 3 userforms one by one. Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=492924 |
Selection of UserForm through button
Hi Saziz
Try: '============= Private Sub CommandButton1_Click() If OptionButton1 Then UserForm1.Show ElseIf OptionButton2 Then UserForm2.Show ElseIf OptionButton4 Then UserForm4.Show End If End Sub '<<============= --- Regards, Norman "saziz" wrote in message ... Hi alok, Here is the code: Private Sub CommandButton1_Click() If Button = OptionButton1 Then UserForm1.Show End If If Button = OptionButton2 Then UserForm2.Show End If If Button = optionbutton4 Then UserForm4.Show End If End Sub What is happening is when I select a button, it shows all 3 userforms one by one. Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=492924 |
Selection of UserForm through button
Norman, Thanks, your code worked fine. Syed -- saziz ------------------------------------------------------------------------ saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350 View this thread: http://www.excelforum.com/showthread...hreadid=492924 |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com