Private Sub val_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim q As Integer
For q = 2 To Col
If KeyCode = vbKeyReturn Then
ws.Cells(11, q) = val.Value 'how to dynamically set this?
question.Value = ws.Cells(10, q)
val.Text = "" 'clear text after pressing enter
'sets back the focus
KeyCode = 0 'what is this?
Me.val.SetFocus
Debug.Print "Value of column " & q
End If
'CreateObject("WScript.Shell").Popup "Data entered, moving to next item.", 2, "Updated", vbInformation 'useful for time based message event
Next q
End Sub
Column variable:
• q is column property i.e column number. This is in row 10.
Userform variables:
• val.: using textbox to enter data into row 11
• question.: displaying column header value in textbox
Overall scheme: question and answer where data is entered col by col per row.
Bookmarks