Multi Userform Data to use next empty cell in current Row.

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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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