Wednesday, March 13, 2013

Excel VBA ComboBox Populate dynamic value

Private Sub UserForm_Click()
With ComboBox1
For Row = 1 To 10 'Each cell in the range
If ActiveSheet.Cells(2, Row) <> "" Then
.AddItem ActiveSheet.Cells(2, Row)
End If
Next Row
End With


ActiveSheet.Cells(5, 5) = ComboBox1.Value

End Sub

No comments: