Andy
Andy

Reputation: 738

VBA Loop to fill numbers in a combobox

Not sure why this seemingly simple piece of code keeps crashing excel for me:

Dim i as Long

For i = 0.25 to 10 step 0.25
    me.combobox1.addItem (i)
Next i

Seems pretty straight forward, I want my combobox to have a list that looks as such:

0.25 0.50 0.75 1.00 . . . 10.00

Upvotes: 1

Views: 2807

Answers (2)

Slai
Slai

Reputation: 22886

Shorter version without loop:

ComboBox1.List = [text(row(1:40)/4,"0.00")]

Upvotes: 4

Jag
Jag

Reputation: 1

maybe try getting rid of i from "Next i" i.e use only Next instead of Next 1

Upvotes: -1

Related Questions