• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Using named ranges in vba [SOLVED]

Brijesh

Member
Hi All

I have two cells C21 and AS10 in two different excel sheets of a workbook. In excel I have defined name of cell C21 as ExpenseInitial and that of AS10 as ExpenseInitialBase. Now I want to assign value of AS20 to C21 through formula. In excel I'll simply type the formula in cell C21 "=[ExpenseInitialBase]"

I want this thing to be done through VBA

For this purpose I am using following code

Range("ExpenseInitial').Formula = "=[ExpenseInitialBase]"

But the above code is giving error.

I also tried the following code

[ExpenseInitial].Formula = "=[ExpenseInitialBase]"

But this is also not working.

Please Guide

Regards

Brijesh
 
Thanks Deepak for your reply but I don't have to assign the value to the cell named "ExpenseInitial". I have to assign a formula to the cell named "ExpenseInitial". I mean something like this:

Range("ExpenseInitial').Formula = "=[ExpenseInitialBase]"

but this code gives error. Can you please suggest the right code for this?
 
Got the reason for the error.
The code should be
Range("ExpenseInitial').Formula = "=ExpenseInitialBase"
 
Back
Top