Define Range Dynamically
I know this one should be easy, but I can't make it work. I'm trying
to dynamically define a range and assign it to a combobox on a user form as the rowsource. Here is my code: dim rngGrpList as Range Set rngGrpList = Sheet1.Range("Groups", Sheet1.Range("Groups").Offset.End(xlDown)) frmManageGroups.cboGroups.RowSource = rngGrpList I'm getting a type mismatch error. It seems that my second line is capturing the contents of the cells rather than their addresses. I've played around with different ideas, but nothing seems to work. Can anybody see why this won't work as intended? Thanks, Randy |
Define Range Dynamically
Does this help?
Sheet1.Range(Sheet1.Range("Groups")(1, 1), _ Sheet1.Range("Groups")(1, 1).End(xlDown)).Name = "Groups" frmManageGroups.cboGroups.RowSource = "Groups" "Randy" wrote in message oups.com... I know this one should be easy, but I can't make it work. I'm trying to dynamically define a range and assign it to a combobox on a user form as the rowsource. Here is my code: dim rngGrpList as Range Set rngGrpList = Sheet1.Range("Groups", Sheet1.Range("Groups").Offset.End(xlDown)) frmManageGroups.cboGroups.RowSource = rngGrpList I'm getting a type mismatch error. It seems that my second line is capturing the contents of the cells rather than their addresses. I've played around with different ideas, but nothing seems to work. Can anybody see why this won't work as intended? Thanks, Randy |
All times are GMT +1. The time now is 05:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com