Userforms to populate cells

Waterpolo1

New Member
Joined
Sep 8, 2015
Messages
21
I have a user form with 3 questions.

1.) Thickness (this selects the correct sheet I have e.g "6-8mm", "10-12mm").
2.) Number of defects. From question 1, this number here is inputed into the correct work sheet.
3.) Number of people. Same as questions 2; this number here is inputed into the relevant cell on the worksheet selected in question 1.

I have the following code but it doesn't appear to work:-

Private Sub Submitbutton_Click()
Sheets("ListBox1.Value").Range("B20").Value = Me.tbdefect.Value


End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Sheets("ListBox1.Value") should be Sheets(ListBox1.Value)
The way it's currently entered, excel is looking for a sheet named "ListBox1.Value" and isn't finding it.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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