ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using macro to name a dynamic cell (https://www.excelbanter.com/excel-programming/317641-re-using-macro-name-dynamic-cell.html)

Papa Jonah

using macro to name a dynamic cell
 
Thanks David. This looks like it would work. I have incorporated it. The
intermediate window indicates that "thisrow" and "thiscolumn" are working.
But the cell is not getting renamed. I've compared it to naming commands
that have specific cells and I can not see the difference.
Any ideas?

Thanks,
Papa

"David" wrote:

Hi Papa,
This assumes you have located on the cell you want to name "AbsSum" and it
first deletes any name "AbsSum", then names the cell you are located on
"AbsName".

Sub Macro1()
ActiveWorkbook.Names("AbsSum").Delete
ThisRow = ActiveCell.Row
ThisColumn = ActiveCell.Column
ActiveWorkbook.Names.Add Name:="AbsSum", RefersToR1C1:="=Sheet1!R" &
(ThisRow) & "C" & (ThisColumn)
End Sub


"Papa Jonah" wrote:

I am automating a process for doing some calculations and "grading". I have
code that sums a column when data is input. However I want that sum to feed
another calculation in another location. Because the position of the cell
with the sum changes with the size of the data set, I can not refer to it by
address. I have looked at naming the cell, but the name appears to be
attached to an address. Currently, the cell with the sum is attached to cell
b1 in a defined range called "absum".

Any ideas would be much appreciated.
TIA



All times are GMT +1. The time now is 10:36 AM.

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