dynamic named ranges
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Dynamic named ranges

Dynamic named ranges

resolvedResolved · Medium Priority · Version 2007

replyReply Thu 9 Jun 2011, 16:02Delegate Nicole said...

Nicole has attended:
Excel VBA Intro Intermediate course

Dynamic named ranges

I would like to know the best practice to set up dynamic named ranges when importing data from an acess database into excel.

For upcoming training course dates see: Pricing & availability

replyReply Fri 10 Jun 2011, 12:38Trainer Stephen said...

RE: Dynamic named ranges

Hi Nicole

The following procedure dynamically assesses the extent of an excel table, assigns that range to a range object and then names that range.
Every time the code is run, the range updates dynamically

Sub DynamicRanges()


Dim rngDynRng As Range


Set rngDynRng = Sheets("Data Validations").Range(Cells(3, 1), _
Cells(Range("A3").CurrentRegion.Rows.Count, Range("A3").CurrentRegion.Columns.Count))

rngDynRng.Name = "MyTable"



End Sub



Hope this is what you were looking for

Regards

Stephen

replyReply Fri 10 Jun 2011, 16:24Delegate Nicole said...

RE: Dynamic named ranges

Stephen,

Thank you for this - very useful.

Best wishes,

Nicole

 

Please browse our web site to find out more about
excel training london and other Microsoft training courses.

Excel tip:

Trace Dependents / Precedents without the blue arrows

Rather than using the toolbar you can press CTRL+] which is the equivelent of trace dependants and CTRL+[ for precendants. Both of these ways though will not show the blue arrows but jump to the cell containing the formula.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard