VBA conditional formatting

rnicholsonaucoin

New Member
Joined
Jun 12, 2019
Messages
2
Hi all,
I am new here and am self-taught (with the help of the internet of course) so my excel/ coding skills are not 100% perfect that is for sure.
I am creating a vba coded userform for work and for the most part I have it functioning... just not exactly how I need it to.
I have a userform (userform1) set up for a client to answer 13 questions, each answer is on a scale from 0-10, the 0-10 answers are optionbuttons.
I have it set up so each questions answer is entered into a cell (range o3:eek:16), this works perfectly BUT each client is to fill this form out 4 times over the course of a couple months.
I need my form to decided where to enter each answer's value (here are my ranges o3:eek:16, p3:p16, q3:q16 and r3:r16)...

can someone give me a code that will make it so if o3 isempty=false then p3=value....(if o3 and p3 isempty= false then q3= value)...etc...

I have a total of 143 optionbuttons, so the code below is modified for each button based on value/cell placement...
here is the current code I am using:

Private Sub OptionButton10_Click()
If OptionButton10.value = True And IsEmpty(Range("o4")) = True Then
Range("o4") = "9"
End If




If OptionButton10.value = True And IsEmpty(Range("o4")) = False Then
Range("P4") = "9"


End If


If OptionButton10.value = True And IsEmpty(Range("o4")) = False And IsEmpty(Range("p4")) = False Then
Range("q4") = "9"


End If


If OptionButton10.value = True And IsEmpty(Range("o4")) = False And IsEmpty(Range("p4")) And IsEmpty(Range("Q4")) = False Then
Range("R4") = "9"


End If


If OptionButton10.value = False Then
' do nothing
End If
End Sub


Thanks in advance, can't wait to see what you have have for me!!

Randi
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
the code above fills in the following ranges o3:eek:16, p3:p16, q3-q16 and r3 (r4:r16 stay empty) on the first entry (first entry should only fill range o3:eek:16)

This is the simple code I was using before:
Private Sub OptionButton102_Click()
If OptionButton102.value = True Then
Range("o13") = "2"
Else
Range("o13") = ""
End If
End Sub

This would only fill in range o3:eek:16 (no coding for ranges p3:p16, q3:q16 or r3:r16)

I am so lost and have exhausted so many search's to try to find what I am looking for!
 
Upvote 0

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

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