Loop function

arunsjain

Board Regular
Joined
Apr 29, 2016
Messages
130
Office Version
  1. 365
Platform
  1. Windows
Hi

I got list in one table which contains three columns (Customer, Product and Type). On the other sheet I got drop down list.

I am looking for a macro through which each row data populate in drop down list one by one. Like S.No.1 will populate in dropdown list then S.No. 2 will populate and then next until end of the table. Could anyone help please?

[TABLE="width: 571"]
<tbody>[TR]
[TD]List
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]S.No.
[/TD]
[TD]Customer
[/TD]
[TD]Product
[/TD]
[TD]Type
[/TD]
[TD][/TD]
[TD]Description
[/TD]
[TD]Drop down list
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]A
[/TD]
[TD]Apple
[/TD]
[TD]Medium
[/TD]
[TD][/TD]
[TD]Customer
[/TD]
[TD]A
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]A
[/TD]
[TD]Banana
[/TD]
[TD]Large
[/TD]
[TD][/TD]
[TD]Product
[/TD]
[TD]Apple
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]B
[/TD]
[TD]Orange
[/TD]
[TD]Small
[/TD]
[TD][/TD]
[TD]Type
[/TD]
[TD]Medium
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]B
[/TD]
[TD]Pears
[/TD]
[TD]Small
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]D
[/TD]
[TD]Fish
[/TD]
[TD]Small
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]E
[/TD]
[TD]Crab
[/TD]
[TD]Medium
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]G
[/TD]
[TD]Chicken
[/TD]
[TD]Medium
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Appreciate your help.

Kind Regards
Arun
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Cross-posted here: https://www.excelforum.com/excel-programming-vba-macros/1213105-loop-function.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered (especially since you claim it has been solved, but did not update this thread!)
 
Upvote 0
try:

Code:
Private Sub LoadCbo()
Dim c As Integer

Range("A2").Select
With cboBox
  While ActiveCell.Value <> ""
       For c = 1 To 3
          .AddItem ActiveCell(0, c).Value
       Next
       
     ActiveCell.Offset(1, 0).Select   'next row
  Wend
End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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