dynamic named ranges

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

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

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

Dynamic named ranges

resolvedResolved · Medium Priority · Version 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:

Currency format

Ctrl+Shift+$ applies the Currency format, with two decimal places

View all Excel hints and tips


Server loaded in 0.06 secs.