在Excel ComboBox中动态设置ListFillRange [英] Dynamically set ListFillRange in Excel ComboBox

查看:482
本文介绍了在Excel ComboBox中动态设置ListFillRange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试做类似的事情:

 cmbMyBox.ListFillRange = "E2"

但是组合框似乎没有填充.

But the combobox does not seem to populate.

推荐答案

好吧,不是要再次回答我自己的问题,但是combobox for Excel上的ListFillRange属性绝对令人发疯.这是我实现的最终代码.

Ok, don't mean to answer my own question again but this ListFillRange property on combobox for Excel was absolutely maddening. Here's the final code that I implemented.

   Sheet1.Range("E3").CurrentRegion.Select
   Dim example as Range
   Set example = Selection

   With cmbMyBox
     .ListFillRange = example.Address(0, 0, x1A1, True)
   End With

这里的问题是我试图使用一个动态范围来动态设置组合框,该范围根据给出的用户输入值而变化.据我了解,我无法使用命名范围,因为命名范围是固定的,例如(A3:Z20)并且无法调整.

The trouble here was that I was trying to dynamically set the combobox using a dynamic range which changes depending on what user inputted values were given. As far as I understand I couldn't use a named range because named ranges are FIXED, e.g (A3:Z20) and cannot be adjusted.

这篇关于在Excel ComboBox中动态设置ListFillRange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆