Select row from ComboBox populated from noncontiguous cells
Posted on 2003-03-20
- I have a combobox populated from the values in various noncontiguous named ranges
- When I click on the combobox, I want to select the cell that the combobox ListIndex refers to.
- I am using the following code which fails:
Dim iTargetNum As Integer
iTargetNum = cboNames.ListIndex + 1 ' Assigns the combobox selection
Range("AllNames").Cells(iTargetAcctNum).Select ' "AllNames" is the named range that consists of
' various smaller named ranges
- If the first contiguous range is A1:A3, and the second contiguous range is A6:A8, and I select the fourth item in the combobox, cell A4 is selected rather than A6.