Multipage userform click option on one page but if I go to another page it wont work

Caveman1964

Board Regular
Joined
Dec 14, 2017
Messages
127
Office Version
  1. 2016
Platform
  1. Windows
I must be driving some of you crazy.
I put in multipage userform with radio buttons to put value in a cell.
I click a tab and a radio button and it puts the value in....but if I decide i needed the other tab page option, i click the tab and it doesnt replace value
But it will replace value if on same tab of the multi page userform.

here is my mess. Please help.


Private Sub UGA_Click()
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"




Sheets("Complaint Entry").Select
Range("E11").Select


If GA23.Value = True Then
ActiveCell.Value = GA23.Caption
ElseIf GA10.Value = True Then
ActiveCell.Value = GA10.Caption
ElseIf GA06.Value = True Then
ActiveCell.Value = GA06.Caption
ElseIf GA04.Value = True Then
ActiveCell.Value = GA04.Caption
'another tab below
ElseIf TH30.Value = True Then
ActiveCell.Value = TH30.Caption
ElseIf TH10.Value = True Then
ActiveCell.Value = TH10.Caption
ElseIf TH13.Value = True Then
ActiveCell.Value = TH13.Caption
ElseIf TH02.Value = True Then
ActiveCell.Value = TH02.Caption
ElseIf TH06.Value = True Then
ActiveCell.Value = TH06.Caption


End If




End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You need to write your script like this:
After the value is entered into the active cell the Option Button is set back to false.
Code:
Private Sub CommandButton2_Click()
'Modified  11/12/2018  8:18:32 PM  EST
If GA23.Value = True Then ActiveCell.Value = GA23.Caption: GA23.Value = False
If GA10.Value = True Then ActiveCell.Value = GA10.Caption: GA10.Value = False
End Sub
 
Upvote 0
Thank you so much.......I so much appreciate you spending your time helping me. I am learning a lot but my brain is hurting....absorbing a lot/1
Thanks
 
Upvote 0
Thank you so much.......I so much appreciate you spending your time helping me. I am learning a lot but my brain is hurting....absorbing a lot/1
Thanks

Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
 
Upvote 0
Again thanks....I was getting an end if block error.....I did something, now i'm not so I dont know. but it works like a charm!
 
Last edited:
Upvote 0
If you wanted to loop through all the Option buttons in your userform to see which one is chosen.
You can use this short script.

Just make sure you do not choose more then one.

Code:
Private Sub CommandButton3_Click()
'Modified  11/12/2018  9:13:07 PM  EST
Dim c As Control
For Each c In Me.Controls
    If TypeName(c) = "OptionButton" Then If c.Value = True Then ActiveCell.Value = c.Caption: c.Value = False
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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