ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Naming (https://www.excelbanter.com/excel-programming/285130-naming.html)

Randal W. Hozeski

Naming
 
I have a simple code that sums a changing range as follows:

Sub AddTotal()
Dim rRange As Range
Set rRange = Range("C2", Range("C65536").End(xlUp))
Range("C65536").End(xlUp)(2, 1) = "=Sum(" & rRange.Address & ")"
End Sub

Question: Is there a way to name the range too, for recall in a ListBox?
It would have to replace the existing name definition as the range changes
each time data is added or deleted from the range.

Any suggestions would be appreciated. Thanks -Randy-

..



Chip Pearson

Naming
 
Randal,

Do you want to name the rRange range? If so, use

ThisWorkbook.Names.Add "TheName",rRange


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Randal W. Hozeski" wrote in message
news:gz_Bb.363158$ao4.1225214@attbi_s51...
I have a simple code that sums a changing range as follows:

Sub AddTotal()
Dim rRange As Range
Set rRange = Range("C2", Range("C65536").End(xlUp))
Range("C65536").End(xlUp)(2, 1) = "=Sum(" & rRange.Address &

")"
End Sub

Question: Is there a way to name the range too, for recall in a

ListBox?
It would have to replace the existing name definition as the

range changes
each time data is added or deleted from the range.

Any suggestions would be appreciated. Thanks -Randy-

.






All times are GMT +1. The time now is 09:22 PM.

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