View Single Post
  #1   Report Post  
Danny
 
Posts: n/a
Default Name a Range - Macro

I have a large workbook with more than a thousand rows. After I sort the
rows, they are separated into 18 groups. I total each group by using sum in
active cell macro.

I'd like to name each total so I add which total I want to add.

If I define a name for each total, the macro would read, example:
ActiveWorkbook.Names.Add Name:="Total1", RefersToR1C1:="=Sheet1!R15C13"
the above macro command refers ro Row 15, Column 13

When I add more date to the workbook and re-sort it, the named range no
longer refers to the total of group one.

How can I write a macro defining a range name in this situation?

Note that I before sorting, I would delete the named ranges then, sum each
group and re-name the total for each group.

Thanks in advance.