ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Name a Range - Macro (https://www.excelbanter.com/excel-worksheet-functions/50407-name-range-macro.html)

Danny

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.


All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com