Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to define a range nk Excel Programming 1 July 19th 07 02:14 PM
how to define a range Negda Excel Programming 1 July 19th 07 01:22 PM
how to define a range in VBA Negda Excel Programming 1 July 19th 07 01:22 PM
Trying to define a range for a graph dynamically within a macro jb Excel Programming 3 March 21st 07 08:36 PM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM


All times are GMT +1. The time now is 03:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"