How do I get combobox to get a cell number then link it to a selection from a checkbox in Excel?

Ayugma

New Member
Joined
Nov 20, 2020
Messages
39
Office Version
  1. 2016
Platform
  1. Windows
I have no idea how to really implement this. So I have 5 checkboxes, all of which are parts to a machine. So, a user will be able to select as many parts as they want. All the parts have part numbers in another worksheet.

For example, if three are selected, I want a combobox to list the part numbers of those three parts. I'm not sure how to implement this in VBA and some guidance would be greatly appreciated. Thanks!
 
Thank you! I checked the code, and made sure everything was correct, and I get this error:
Run-time error '1004':

Application-defined or object-defined error

I'm not really sure what that means or what I should be fixing.

Additionally, you also asked me to modify searchString = CheckBox1.Caption. What should I modify with what?
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Furthermore, I looked at the Range and saw that you included B39-B45. However I'm not sure if that scans column A for the Capstions, so I did Range("A38:B45"). If I keep B39-B45 like you have done, it'll tell me that the string is not found.
 
Upvote 0
Thank you! I checked the code, and made sure everything was correct, and I get this error:
Run-time error '1004':

Application-defined or object-defined error

I'm not really sure what that means or what I should be fixing.

Additionally, you also asked me to modify searchString = CheckBox1.Caption. What should I modify with what?
Well you have I believe 5 checkboxes.
Furthermore, I looked at the Range and saw that you included B39-B45. However I'm not sure if that scans column A for the Capstions, so I did Range("A38:B45"). If I keep B39-B45 like you have done, it'll tell me that the string is not found.
Well I believe you have 5 checkboxes.

So you will have checkbox1 and checkbox2 and so on.

So the script will be looking for Checkbox1. caption and checkbox2 caption so on the other scripts change CheckBox1 Caption to CheckBox2 Caption and so on.

If you do not understand just use the scripts I provide and it will work on the First two check boxes.

And my script is written correctly for the range B45 and on
The script then looks to column A for the part name
 
Upvote 0
Furthermore, I looked at the Range and saw that you included B39-B45. However I'm not sure if that scans column A for the Capstions, so I did Range("A38:B45"). If I keep B39-B45 like you have done, it'll tell me that the string is not found.
The way I wrote it is correct.
 
Upvote 0
Okay, I changed it back to what you originally had and it gave me this issue:
problem_1.png

When the checkbox one is available in my original sheet:
p_2.png

So I'm not sure what's causing the issue.

Edit: Could it be because I am using ActiveX instead of UserForm?
 
Upvote 0
You told me the Textbox will have a Part number you want to search for in sheet named:
"Table of Part Numbers" Range("B39:B45")
and then add the Part name found in column A same row to the combobox

from your image it appears you have partname as Chekbox1 caption
 
Upvote 0
From your image you are showing part names in the checkboxes not part numbers.
 
Upvote 0
Sorry yes, I don't think I explained it correctly. My bad.

I shouldve had images from the start. How I have it is what I would like.
 
Upvote 0
I went back and read your original post again and after seeing your image I did the script incorrectly.
I thought we were searching for part numbers.
I will Rewrite script
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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