开发者

Creating a Dynamic Range with a Macro

YearMth   Region   Employee   Item     Units     Unit Cost     Total 
--------------------------------------------------------------------
2006-12   DC       Jones      Pen Set  700       1.99          1,393 
2006-12   NY       Peterson   Binder   85        19.99         1,699 
2006-12   DC       Howard     Pen Set  62        4.99          309 
2006-12   DC       Gill       Pen     开发者_运维技巧 58        19.99         1,159 
2006-12   NY       Anderson   Binder   10        4.99          50 
2006-12   NY       Anderson   Pen Set  19        2.99          57 

Using this data how would I create a Dynamic Range using a Macro.

Thanks


Depends what you want to do! But here's an example

ActiveWorkbook.Names.Add Name:="MyDynamicRange", 
    RefersToR1C1:= "=OFFSET(Sheet1!R2C2,0,0,COUNTA(Sheet1!R2C2:R200C2),1)"

This range will contain all your Regions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜