Reference named range into a cell formula

Chopsaki

New Member
Joined
Mar 23, 2019
Messages
7
Hi,

I column "A", I have a list of named ranges. In another column, I want to paste into the cell the named range in that row
I have 100 rows, and use a simple loop to pass through the rows. However I cannot get the content of the reference cell into the formula of the other?

Should I be using a copy/paste command instead? - Can't get that to work either..

Dim I as integer

I = 1
Do While I < 101
Cells(i,1).value = Cells(I,2).value
I=I+1

Loop
End Sub


Thanks in advance!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Do you only want to copy column A in B?
Or you want to get something from column A and put it in B
 
Upvote 0
@Chopsaki, going by your description you have the cells the wrong way around...


Code:
    Dim I As Long
    I = 1
    Do While I < 101
        Cells(I, 2).Value = Cells(I, 1).Value
        I = I + 1
     Loop

Although if all you are doing is copying the whole range you could do that without looping.
 
Last edited:
Upvote 0
Or do you mean something like
Code:
   Dim i As Long
   i = 1
   Do While i < 101
      Cells(i, 2).Formula = "=sum(" & Cells(i, 1).Value & ")"
      i = i + 1
   Loop
 
Upvote 0
Hi, I want to get the value of a cell in column A and insert it into column B as a formula;

Column A value "_named_cell_1" becomes formula in column B "=_named_cell_1"
 
Upvote 0
Or do you mean something like
Code:
   Dim i As Long
   i = 1
   Do While i < 101
      Cells(i, 2).Formula = "=sum(" & Cells(i, 1).Value & ")"
      i = i + 1
   Loop

This code fails in error on line 3? But I think you are correct in quoting the ".formula =".
It's working out how to reference the value in the reference cell to become the formula in the other..
 
Upvote 0
Hi All,

Found the answer Irequired - below is the script that can reference the value of one cell(containing the named cell reference), and use it as a formula reference inanother cell.

Thanks to those thatanswered!

Sub MacroUsers4()


Dim i As Long
i = 1
Do While i < 100
Cells(i, 11).Formula = "="& Cells(i, 15).Value
i = i + 1
Loop

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,988
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top