thebadfish
New Member
- Joined
- Nov 22, 2023
- Messages
- 2
I am attempting to utilize multiple userforms for a set of 15 questions that require a rating as well as a remark for said question. I have been able to reuse some code I had from a prior spreadsheet that would enter data from a userform and any subsequent forms would be moved to the next empty row. However I would like for the information from the userforms with questions to follow along horizontally until all are answered. i.e. Question 1 Rating and Note would go into A1, Question 2 Rating and Note would go into the next empty cell in that row, which in this case would be A2, so on for a total of 15 questions. Below is the code I am trying to use. For question 1 it goes into the proper cell and adds both the rating and the note attached but I dont know how to get it to go to the next cell to the right that is empty. Could this be modified to do what I am wanting?
Code:
Private Sub q1next_Click()
With Worksheets("Sheet1")
a = .Range("A:A").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
b = .Cells(.Rows.Count, "A").End(xlUp).Row
If a = b Then
.ListObjects("Table6").ListRows.add
LastRow = b + 1
Else
LastRow = a + 1
End If
.Cells(LastRow, 1).Value = Me.rating1.Value
.Cells(LastRow, 1).NoteText Text:=Q1.remark1.Value
End With
Unload Q1
Q2.Show
End Sub