Name a cell

Asked

Viewed 955 times

2

Goodnight,

I am making a rule in vba that will run for all worksheet lines. So I created a variable, Cells(l,3) = "ID", but when I call this variable in the formulas is returning the word ID instead of the value in the cell (L,3).

Can someone help me?

1 answer

1

Via VBA

Dim r As Range
Set r = Range("E2")
r.Name = "ONomeDaCelula"

Alternative via Excel Interface

Open the context menu of the cell you want to set a name. You can do this by right-clicking:

inserir a descrição da imagem aqui

Set the name of the dialog box:

inserir a descrição da imagem aqui

To test, Enter a value in the cell

inserir a descrição da imagem aqui

Select any other cell and invoke the value by the quick formula input. In this case it is =foo

inserir a descrição da imagem aqui

With this you will have the expected result

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.