Use a named range in an excel worksheet to propagate a listbox
So I have a number of namedRanges in an excel worksheet. I would like to use these to fill in comboboxes on a user form in the same WorkBook.
I have tried:
开发者_如何学GocboMember.DataSource = Globals.Sheet1.MemberRange.Value
No error is given but the combo is blank. Does anybody have any ideas?
I'm trying to use VSTO for VS 2008 on an excel 2003 work book.
cboMember.RowSource = "NamedRange"
You don't set it to an object. Set it to a string. Excel figures out the rest.
This is a bit of a guess, but I believe in VBA you can do something like just Range("MyRangeName")
to get the named range, so you could try the equivalent of that.
Some ranges in Excel are local to a sheet, some are global to the workbook. If they're local to a sheet then you'll need to prefix with sheet name, e.g. Range("Sheet1!MyRangeName")
.
精彩评论