Thread: Looping Problem
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Todd Huttenstine[_3_] Todd Huttenstine[_3_] is offline
external usenet poster
 
Posts: 68
Default Looping Problem

Below is a code I am trying to modify.

For Each Item In NoDupes
OrderForm.ComboBox1.AddItem Item
Next Item

The above code works but is not what I need. Because the actual ComboBox
will not always be ComboBox1, I need to make the code dynamic. I need the
code to look in cell V1 on worksheets(8) for the value. This value in that
cell will be the current combobox that needs to be in the code. For
example, lets say the value in cell V1 in worksheets(8) is "CombBox9", then
I would need for the code to reference combobox9. So how would I write this
code?

I tried the below modification and it failed.
For Each Item In NoDupes
OrderForm.Worksheets(8).Range("V1").Value.AddItem Item
Next Item

When I ran it, I got an error that said Complie error. Method or data
member not found.


Thanks in advance.

Todd Huttenstine