Using Dynamic Named Ranges in VBA

GandalfTheWhite

New Member
Joined
Jul 24, 2009
Messages
37
I busy building a Form in VBA (Excel) and I cannot reference my Dynamic named Range in VBA (and it does not exists in my Named Ranges Drop Down on the Excel Page), yet I can reference it through Validation/List on the Excel Sheet (but want to use a Form to input the data).
Does anyone have any ideas how to activate these Dynamic named ranges (other than making it static and having someone change the Range each time the list is added to).

Thank you.

My range is =OFFSET(RefData!$D$2,0,0,COUNTA(RefData!$D195:$D293),1)

GTW.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Let's assume that name of your dynamic named range is MyRange. To specify the dynamic named range for the RowSource property in the properties window, enter MyRange. To refer to it in code, refer to it as Range("MyRange"). By the way, dynamic named ranges do not appear in the Name Box drop down list. However, you can type the name in the Name Box to select the range on the worksheet.
 
Upvote 0
Thanks Domenic, but I'm still struggling to declare the range, tried this but it's still not accessible in the RowSource. My Dynamic Named Range is called IncidentOwner.

Private Sub IncOwnercbo_Click()
Dim IncOwn As Range
IncOwn = Range("IncidentOwner")
End Sub

Thanks again.

GTW
 
Upvote 0
Thanks Domenic, but I'm still struggling to declare the range, tried this but it's still not accessible in the RowSource. My Dynamic Named Range is called IncidentOwner.

Private Sub IncOwnercbo_Click()
Dim IncOwn As Range
IncOwn = Range("IncidentOwner")
End Sub

Thanks again.

GTW

If you've defined the name at the worksheet level so that it's scope is 'RefData', try...

RowSource:

RefData!IncidentOwner​

VBA Code:

Worksheets("RefData").Range("IncidentOwner")​

Does this help?
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top