ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Survey Form (https://www.excelbanter.com/excel-discussion-misc-queries/47139-survey-form.html)

John

Survey Form
 
Hello,

I want to take a poll with approx 5 answer options displayed as radio
buttons or check marks. i.e. Options are Monday, Tuesday, Wednesday,
Thursday, Friday, When all users answer, I want to paste answers into one
spreadsheet then look at
activity X and count how many answered Monday, Tuesday, Wednesday, Thursday,
Friday. Any suggestions on how to start would be great.

Just remeber that I'll be sending the workbook as an attachment via email to
everyone. I would like to make it's as simple as possible for them to open
answer and resend back to me. Thank you.

John

moondark


Hi,

I created a Spreadsheet with the name "Start" and added 5 Optionbuttons
named "Choice1" to Choice"5" and a commandbutton to execute the code and
to vote.

The following code works but I'm not absolutely sure if it fits your
needs

Code:
--------------------
Private Sub CommandButton1_Click()
'Check if Spreadsheet "Result" exists
newone = True
For Each s In Sheets
If s.Name = "Result" Then newone = False
Next s
'if there's not such a sheet create it
If newone = True Then
Set ResultSheet = ActiveWorkbook.Worksheets.Add
ResultSheet.Name = "Result"
End If
'activate the sheet
Sheets("Result").Activate

'Fill in the values of the OptionButtons Where true = -1 and False = 0 _
so you have to subtract the value
Sheets("Result").Cells(1, 1) = Sheets("Result").Cells(1, 1) - Sheets("Start").Choice1.Value
Sheets("Result").Cells(2, 1) = Sheets("Result").Cells(2, 1) - Sheets("Start").Choice2.Value
Sheets("Result").Cells(3, 1) = Sheets("Result").Cells(3, 1) - Sheets("Start").Choice3.Value
Sheets("Result").Cells(4, 1) = Sheets("Result").Cells(4, 1) - Sheets("Start").Choice4.Value
Sheets("Result").Cells(5, 1) = Sheets("Result").Cells(5, 1) - Sheets("Start").Choice5.Value


End Sub
--------------------


it's rather simple and therefore not dynamic (,yet).
But I preferred plain code, you can learn from ;)

The code creates a Sheet called "Result" if it doesnt exist and writes
the values of the optionbuttons in Cells A1 to A5. I didnt work on
Headlines a.s.o. because everyone has his own design :)
You could also add a code fragment that checks if there is an
optionbutton selected (if not then msgbox("alert"))
something like that.


Regards,

Simon


--
moondark
------------------------------------------------------------------------
moondark's Profile: http://www.excelforum.com/member.php...o&userid=27390
View this thread: http://www.excelforum.com/showthread...hreadid=470660



All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com