Macros and field names

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I am extracting records, as part of a macro, from a list range on the
worksheet into a data named range. At times the source table will be
increased or decreased in size and when I run the macro I want it to resize
the extracted name range. How do I program this within the macro?
 
Hi

Maybe this will help you:

NameRange = Range("A1", Range("A1").End(xlDown)).Address
ActiveWorkbook.Names.Add Name:="MyRangeName", RefersTo:="=Sheet1!" &
NameRange

Regards,
Per
 
Hi,

Suppose that the data is extracted to A1:D200

Range("A1").CurrentRegion.Name = "Database"

This assumes there is no data that is touching your extract that is not part
of the range you want to name.
 
Back
Top