Naming

  • Thread starter Thread starter Randal W. Hozeski
  • Start date Start date
R

Randal W. Hozeski

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-

..
 
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
 
Back
Top