Hi,
This is exercise based so the data is entered on paper and then the data is collected and entered into Excel via a userform.
The User is presented with a screen which has OptionButtons for Team Members 1 to 10, and Question Boxes 1 to 10. The person entering the data, selects the Team Member 1 (for example) and enters the scores in each of the textboxes for questions 1 to 10. Then clicks apply before selecting the next Team Member via OptionsButton and repeats the process.
I have this working via If Then Else Statements, the data is stored in the correct cells in excel, but as you can imagine the code would be considerable (in my untrained status - trying hard to learn), example of the code is below
This would need to be repeated for each of the 10 question boxes and each of the 10 option buttons, plus I tried doing error checking to ensure the values entered in each of the boxes are between 0 and 9.5, the only way that I could get it to work was to create an if statement for each of the ranges. See Below, (ErrorM - the error Message is declared under the variables and its value is set (msgBox) just below those.
That is just for 2 of the textboxes for Team Member 1.
I tried using case statements but could not get it to work, wouldn't write the data to excel
Again this would need to have a case statement for all Team Members (option Buttons) and all 10 questions for each.
Any pointers I would be grateful.
Sorry for the long post.
Regards
This is exercise based so the data is entered on paper and then the data is collected and entered into Excel via a userform.
The User is presented with a screen which has OptionButtons for Team Members 1 to 10, and Question Boxes 1 to 10. The person entering the data, selects the Team Member 1 (for example) and enters the scores in each of the textboxes for questions 1 to 10. Then clicks apply before selecting the next Team Member via OptionsButton and repeats the process.
I have this working via If Then Else Statements, the data is stored in the correct cells in excel, but as you can imagine the code would be considerable (in my untrained status - trying hard to learn), example of the code is below
Code:
If OptBTM4.Value = Checked Then
Range("B16").Value = TbTMQ1.Text
Range("C16").Value = TbTMQ2.Text
Range("D16").Value = TbTMQ3.Text
Range("E16").Value = TbTMQ4.Text
Range("F16").Value = TbTMQ5.Text
Range("G16").Value = TbTMQ6.Text
Range("H16").Value = TbTMQ7.Text
Range("I16").Value = TbTMQ8.Text
Range("J16").Value = TbTMQ9.Text
Range("K16").Value = TbTMQ10.Text
Else
This would need to be repeated for each of the 10 question boxes and each of the 10 option buttons, plus I tried doing error checking to ensure the values entered in each of the boxes are between 0 and 9.5, the only way that I could get it to work was to create an if statement for each of the ranges. See Below, (ErrorM - the error Message is declared under the variables and its value is set (msgBox) just below those.
Code:
If OptBTM1.Value = Checked Then
Range("B13").Value = TbTMQ1.Text
If TbTMQ1.Value = ("<0, OR >9") Then
MsgBox ("ErrorM")
End If
Range("C13").Value = TbTMQ2.Text
If TbTMQ2.Value = ("<0, OR >9") Then
MsgBox ("ErrorM")
End If
That is just for 2 of the textboxes for Team Member 1.
I tried using case statements but could not get it to work, wouldn't write the data to excel
Code:
Select Case Checked = True
Case OptB1
Range("B8").Value = TbTMQ1.Text
Range("B13").Value = TbTMQ1.Text
Range("B18").Value = TbTMQ1.Text
Range("B23").Value = TbTMQ1.Text
Range("B28").Value = TbTMQ1.Text
Range("B33").Value = TbTMQ1.Text
Range("B38").Value = TbTMQ1.Text
Range("B43").Value = TbTMQ1.Text
Range("B48").Value = TbTMQ1.Text
Range("B53").Value = TbTMQ1.Text
End Select
Again this would need to have a case statement for all Team Members (option Buttons) and all 10 questions for each.
Any pointers I would be grateful.
Sorry for the long post.
Regards