Making a very large user form

Chicken6

New Member
Joined
Dec 30, 2012
Messages
15
Hi all.
I am trying to develop a questionnaire with 50 questions. I can only fit 13 questions on the screen. Do I use scroll or split the form?

Each question has 5-options (very inaccurate, moderately inaccurate, neutral, moderately accurate, and very accurate). Each question has 5 option buttons grouped. So in all there will be 250 option buttons. The code is below with only the first question. The participant enters their number and the results are saved in a worksheet when the submit command button is clicked (copied this code from elsewhere and it works well).

I am very new to VBA and this is my first attempt. I have tried using scroll and setting ScrollBars property of the userform to 2 (frmScrollBarsVertical), and setting the ScrollHeight property to a value greater than the userform's height...which is at 950. This doesn't work (the scroll bar appears but is not functioning). Additionally, anything over height 1000, the form top is lost and excel freezes. Not sure how to fit in more than the 13 questions that fit on the screen.

I am developing it at home on Excel for Mac 2011, VBA version 14.2.5 (and will be running it on PCs in the lab).

Any pointers would be greatly appreciated.

Code:
Option Explicit
Private Sub TextBoxSubjectNumber_Click()

End Sub

Private Sub TextBoxSubjectNumber_AfterUpdate()
Sheets("Results").Range("A2").Value = TextBoxSubjectNumber.Text
End Sub

Private Sub OptionButton1_Click()
    Sheets("Results").Range("B2").Value = "1"
End Sub
Private Sub OptionButton2_Click()
    Sheets("Results").Range("B2").Value = "2"
End Sub
Private Sub OptionButton3_Click()
    Sheets("Results").Range("B2").Value = "3"
End Sub
Private Sub OptionButton4_Click()
    Sheets("Results").Range("B2").Value = "4"
End Sub
Private Sub OptionButton5_Click()
    Sheets("Results").Range("B2").Value = "5"
End Sub

Private Sub CommandButtonSubmitExit_Click()
Dim wb As Workbook
  Dim FolderName As String
    FolderName = TextBoxSubjectNumber.Text & _
     Format(Now, "_dd-mm-yyyy hh-mm\")
    Application.ScreenUpdating = False
     On Error Resume Next
        On Error GoTo 0
    ActiveSheet.Copy
  Set wb = ActiveWorkbook
  With wb
      .SaveAs FolderName & ".xls", FileFormat:=xlWorkbookNormal
  End With
  Application.ScreenUpdating = True
Unload UserFormPreScenario
ActiveWindow.Close

End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I think I have worked it out. Will create 4 userforms in the workbook. At the end of each userform I will have the command button open the next user form as well as place the participant number in the text box of the next form. The last form will save the subsequent filled in worksheet with a name including the participant number. So far so good!
:)
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

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