Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

STL - Formerly Best Training Solutions Through Learning
TrustPilot
Excellent
Request Callback We will call you back
0207 987 3777 Call for assistance
Your Basket Basket is empty
dynamic named ranges

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

Dynamic named ranges

ResolvedVersion 2007

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.

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

RE: Dynamic named ranges

Stephen,

Thank you for this - very useful.

Best wishes,

Nicole

Excel tip:

Hide columns in an Excel 2010 Worksheet

If you don’t want part of the Excel worksheet to be visible or when you don’t want certain data to appear in print outs, then a simple solution is to temporarily hide a column or multiple columns.

Hiding a single column:

1)Right click on the column header of the column you want to hide (this is the grey bar along the top edge of the worksheet)
2)Choose Hide from the menu
3)This column will now be hidden from view

Hide more than one column:

1)In the column header drag select to highlight the columns you want hidden
2)Right click and choose Hide from the menu

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.