New to VBA, Creating a Userform with a variety of options

HollyLouise

New Member
Joined
Feb 7, 2013
Messages
3
Hello All,

Bit of background; I am trying to automate an excel sheet which produces a report. Where if something is true, it will return a statement from the statements sheet. If not, it will be blank. However, I do not want it to be too automated (as then it will lose its personal touch) and thus, I have added the random function for numbers 1-5 (in formula below exists in cell G2) and then written the same sentences in various different ways to add a human touch and the randomised function will chose a sentence from the statements sheet at random and thus each report will be slightly different.

So the nitty gritty, I have created a userform with 3 option boxes, two with yes or no answers, where for example, if the person selects option box 1, then it will follow an "if" formula which is "=IF(G2=1, Statements!B3, IF(G2=2, Statements!B4, IF(G2=3,Statements!B6, IF(G2=4, Statements!B5, IF(G2=5, Statements!B7, "")))))"

N.B.statement is another sheet and I want the information placed into the current sheet in cell G4 (which has the button which links to the userform). If the person selects no, then the cell is left blank.

I want the same to be for the other boxes, with the one with three options, "severe", "mild", "none", where severe and mild will produce an If formula similar to the above, and none will return a blank cell.

Lastly there is a tick box, which each tick box will again follow a similar IF formula, where if it is ticked, then it will produce a statement from Statements sheet, and if not, then blank.

Finally, I have a button on the userform called create report, where, once the person has selected the various options and tick boxes, it will run the report, where all the above will be completed and filled in.

So I need a code to do the above. Do I select the boxes to add code or the individual yes or no tick boxes?

I know this is probably totally basic, but I am extremely new to this, and I need to complete this soon, I hope someone can explain/help me!

Thank you ever so much.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,216,116
Messages
6,128,932
Members
449,480
Latest member
yesitisasport

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