Gather ALL Combobox Selections into a Column

robertmwaring2

Board Regular
Joined
Mar 8, 2019
Messages
132
Office Version
  1. 365
Platform
  1. Windows
Hey All,

I am COMPLETELY NEW to VBA and an attempting the "learn as I go" method. I am a chef, and am attempting to create production sheets based on menu selections. I am creating a userform (UFProductionSheet) to make the selections and enter other needed details. All menu selections are purposely made from comboboxes (all of which contain "cb" as the first letters in their names). I have created a button captioned "Submit" that transfers all userform information to specific cells on various sheets in the workbook. There are textboxes with information that go to one sheet ("Production Sheet"), and ALL the comboboxes go to a column in another. ("Info Sheet") There are quite a few comboboxes, and thus far I only know how to enter the value of each into a specific cell (each individually) - which is fine albeit time consuming, but I was wondering if there is a way to compile a list of all combobox values that are not "" (blank) and place that list in a column (Column "CB") in a specific worksheet ("Info Sheet") - that way I can avoid blank cells in that column and perhaps less code? I have tried to research how to accomplish this but apparently am not formulating my question correctly and cannot find an answer. Thanks in advance for the help.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How about
Code:
Private Sub CommandButton2_Click()
   Dim Ctrl As Object

   For Each Ctrl In Me.Controls
      If TypeName(Ctrl) = "ComboBox" Then
         If Ctrl.Value <> "" Then
            Sheets("Info Sheet").Range("CB" & Rows.Count).End(xlUp).Offset(1).Value = Ctrl.Value
         End If
      End If
   Next
End Sub
 
Upvote 0
Solution
Bless Your Soul
This is genious, I have been typing the same line of code repeatedly making a few changes to each for what seems like an enternity now. Thank you so much.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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