writing multiple lines on worksheet based on the multiple selections of a listbox in a form

jamwalk

New Member
Joined
Mar 28, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am new to vba. I have created a work request form where the user selects a block, type of work required, and inserts their name and details, when they press submit that information is then written to a worksheet (Work Status). which works fine.
What i want to happen is the for user to be able to select multiple blocks with the same type of work details etc and written to separate lines on the worksheet.
lets say user selects blocks 1, 2, 3, 4, 6, 50 and they want those block mowed. when submit is pressed each block should be on a separate line of the work sheet all with the same info.
Help would be greatly appreciated

Private Sub CommandButton1_Click()
Dim ssheet As Worksheet

Set ssheet = ThisWorkbook.Sheets("Work Status")


nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1

ssheet.Cells(nr, 1) = CDate(Me.tbdate)
ssheet.Cells(nr, 2) = Me.lbblock
ssheet.Cells(nr, 3) = Me.cbinquiry
ssheet.Cells(nr, 4) = Me.tbdetails
ssheet.Cells(nr, 5) = Me.tbname


lbblock.Text = ""
tbdetails.Text = ""
tbname.Text = ""
cbinquiry.Text = ""


ThisWorkbook.Save



End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Watch MrExcel Video

Forum statistics

Threads
1,129,924
Messages
5,639,025
Members
417,064
Latest member
oryngirl

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
Top