T
teddy b via OfficeKB.com
Anyone can help? I want to sort my data call from excel file then populate
to word combobox. I need to capture the column 1 ID but display Column 2 data.
How to sort the data in alphabetical order?
My script as below:
With Me.cboBox
.ColumnCount = 2
.BoundColumn = 2
.ColumnWidths = ".5 in; .0 in"
For iRow = 2 To wb.Worksheets("sheet1").Range("A65536").End(xlUp).Row
Set myCell = wb.Worksheets("sheet1").Cells(iRow, 2)
If myCell.Offset(0, 1).Value = 0 Then
.AddItem myCell.Value
.List(.ListCount - 1, 1) = myCell.Offset(0, -1).Value
End If
Next iRow
End With
Many Thanks.
to word combobox. I need to capture the column 1 ID but display Column 2 data.
How to sort the data in alphabetical order?
My script as below:
With Me.cboBox
.ColumnCount = 2
.BoundColumn = 2
.ColumnWidths = ".5 in; .0 in"
For iRow = 2 To wb.Worksheets("sheet1").Range("A65536").End(xlUp).Row
Set myCell = wb.Worksheets("sheet1").Cells(iRow, 2)
If myCell.Offset(0, 1).Value = 0 Then
.AddItem myCell.Value
.List(.ListCount - 1, 1) = myCell.Offset(0, -1).Value
End If
Next iRow
End With
Many Thanks.