improving userform

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have a userform which has a label as a question and 3 radios buttons as an answer. The form is this

http://tinypic.com/r/6gaj2q/9


http://i65.tinypic.com/6gaj2q.jpg

When use click on Math button, math cell value will be incremented by 1. Everything is working fine if a user will click on Math then Excel or History etc but nothing would happen if a user click on Math twice for example. How would you fix/improve this code. Thank you so much

Code:
Private Sub Excel_Click()
Cells(2, 1) = Cells(2, 1) + 1
End Sub


Private Sub history_Click()
Cells(2, 3) = Cells(2, 3) + 1
End Sub


Private Sub Math_Click()
Cells(2, 2) = Cells(2, 2) + 1
End Sub
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
.
Code:
Private Sub Excel_Click()
If Excel_Click = True then
	Exit sub
Else
	Cells(2, 1) = Cells(2, 1) + 1
end if
End Sub




Private Sub history_Click()
If history_Click = true then
	Exit Sub
else
	Cells(2, 3) = Cells(2, 3) + 1
end if
End Sub




Private Sub Math_Click()
If Math_Click = True then
	Exit Sub
Else
	Cells(2, 2) = Cells(2, 2) + 1
End If
End Sub
 
Upvote 0
Thank you for your help. I got compiler error. Is it Excel_Click= true or Excel.value=True?
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,315
Members
448,564
Latest member
ED38

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