View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fredriksson via OfficeKB.com Fredriksson via OfficeKB.com is offline
external usenet poster
 
Posts: 51
Default Add a Dynamic Name Range

Using This Workbook module, I need to set up Name Ranges everytime the Work
Book is Open but the size of the range may change between each opening and
the user may delete a range when open.

When I recorded a Name defining Macro, it produce this code.
ActiveWorkbook.Names.Add Name:="CompanyXrefRange", RefersToR1C1:= _
"='Xref Property'!R2C1:R3182C4"

When I resize the range in my code I use this code
CompanyXrefRange.Resize(CompanyData.Rows.Count + 1, CompanyData.Columns.Count)
Name = "CompanyXrefRange"

Can I combine the two concept above so when This Workbook is executed it will
coount the rows and the columns to create the appropriate size of the Range

Thanks

--
Message posted via http://www.officekb.com