Thread: Add Cell name
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KentAE[_2_] KentAE[_2_] is offline
external usenet poster
 
Posts: 6
Default Add Cell name

Hi Guys, I'm trying to give active cell a name but it doesn't work. Please
help me!

Sub CellName()
Dim myFile, myKlas, myDiv, myName, rc, ref As String

myFile = ActiveSheet.Name ' it's "D35" for example
myKlas = myFile
myDiv = ActiveCell.Value ' it's "South" for example

myName = myKlas & myDiv ' the name I want to give the cell

Row = ActiveCell.Row
Col = ActiveCell.Column
rc = "R" & Row & "C" & Col

ref = myFile & "!" & rc
ActiveWorkbook.Names.Add Name:=myName, RefersTo:="=" & ref & " """
End Sub
--
If you are old enough, you have your future behind you.