View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Joe[_46_] Joe[_46_] is offline
external usenet poster
 
Posts: 48
Default Redefining a table range with a macro

On May 21, 4:57*pm, OMER wrote:
Hello,
I need help creating code to redefine a table within a macro. I used the
macro recorder to creata a table with the same name but to point to another
locations.

* * ActiveWorkbook.Names("Table1").Delete
* * ActiveWorkbook.Names.Add Name:="Table1", RefersToR1C1:= _
* * * * "='Sheet1'!R3C28:R12C37"

How do I make this dynamic, so the starting point, #of rows and # of columns
are defined by variables?

Help is much appreciated.
Regards,
OMER


sorry if I assumed too much!

if its just to resize, you can use a dynamic range
In excel define a named range with following formula.

Named_Range = OFFSET('Sheet1'!$A$1,1,0,COUNTA('Sheet1'!$A:$A),5)

HTH
Joe