ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning formula using a macro (https://www.excelbanter.com/excel-programming/280865-assigning-formula-using-macro.html)

LSB

Assigning formula using a macro
 
Hi,

How can I assign a cell's value equal to another cell
using a macro. I would like to address the cell by it's
own cell box name that I will assign. For example:

Cell Box Cell Name
A1 JanBalBF
A10 JanBalCF
C1 FebBalBF
C10 FebBalCF

Now, I want to use the macro to assign the value in A10
to C1 by addressing the cells by using the Cell Name
assigned earlier. I tried using the following formula in
the macro, unfortunately doesn't work

LET [FebBalBF] = [JanBalCF]

I got the error #NAME in the C1 Cell.

How can I go about doing it?

Thanks in advance.

Tom Ogilvy

Assigning formula using a macro
 
Worked fine for me:

Range("A1").Name = "JanBalCF"
Range("C1").Name = "FebBAlBF"
Range("JanBalCF").Value = 100
[FebBalBF] = [JanBalCF]
? Range("FebBalBF").Value
100


--
Regards,
Tom Ogilvy

"LSB" wrote in message
...
Hi,

How can I assign a cell's value equal to another cell
using a macro. I would like to address the cell by it's
own cell box name that I will assign. For example:

Cell Box Cell Name
A1 JanBalBF
A10 JanBalCF
C1 FebBalBF
C10 FebBalCF

Now, I want to use the macro to assign the value in A10
to C1 by addressing the cells by using the Cell Name
assigned earlier. I tried using the following formula in
the macro, unfortunately doesn't work

LET [FebBalBF] = [JanBalCF]

I got the error #NAME in the C1 Cell.

How can I go about doing it?

Thanks in advance.





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

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