Name a range dynamically

J

Jerry

I have a list I'm using in a vlookup. The problem is that
this list changes drastically in size and I think by
naming the range (i.e. database, stuff, etc.) that I could
use that name in my vlookup. How do I program a range to
have a name in VBA?
 
P

Peter Atherton

Jerry

One way, select a cell in the list and alter the columns
to suit.

nr = ActiveCell.CurrentRegion.Rows.Count - 1
Set Status = Range(Cells(2, 4), Cells(nr, 4))

Regards
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top