VBA Loop to fill numbers in a combobox

十年热恋 提交于 2021-02-10 16:20:50

问题


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


回答1:


Shorter version without loop:

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



回答2:


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



来源:https://stackoverflow.com/questions/45155642/vba-loop-to-fill-numbers-in-a-combobox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!