davedave24
Programmer
Hi all
I have a combobox with 2 columns. I need it to be filled with Names in col1, and Email in col2.
The data comes from an Excel sheet. We find the row relating to the specific customer, then grab the data, starting at column C.
The data is stored: NAME1 EMAIL1 NAME2 EMAIL2 NAME3 EMAIL3 etc.
What I have so far jumbles everything up, so the combobox ends up like this:
NAME1 EMAIL1
EMAIL1 NAME2
NAME2 EMAIL2
EMAIL2 etc.
SelCustomer is just an integer to locate the row we're using.
Thanks
I have a combobox with 2 columns. I need it to be filled with Names in col1, and Email in col2.
The data comes from an Excel sheet. We find the row relating to the specific customer, then grab the data, starting at column C.
The data is stored: NAME1 EMAIL1 NAME2 EMAIL2 NAME3 EMAIL3 etc.
What I have so far jumbles everything up, so the combobox ends up like this:
NAME1 EMAIL1
EMAIL1 NAME2
NAME2 EMAIL2
EMAIL2 etc.
Code:
Dim cell As Range
Dim Rng As Range
With ThisWorkbook.Sheets("Customers")
.Activate
Set Rng = .Range("C" & SelCustomer + 2, .Range("C" & SelCustomer + 2).End(xlToRight))
End With
For Each cell In Rng.Cells
With Me.comboTo
.AddItem cell.Value
.List(.ListCount - 1, 1) = cell.Offset(0, 1).Value
End With
Next cell
SelCustomer is just an integer to locate the row we're using.
Thanks