How to use a range variable as a function argument

KS_user

New Member
Joined
Jun 10, 2015
Messages
44
I'm trying to make the "EDS_Value" formula act on each cell in the range MasterTag (the cell in the column next to it is also an argument). However, I keep getting an "application- or object- defined error." I'm almost positive it's something to do with the syntax of how I'm entering 'cell' into the formula argument, but I've tried everything and I can't get it to work. Help! Thanks!

Sub MasterTagList()

Dim MasterTag As Range
Dim Cell As Range

For Each Cell In Range("MasterTag")
Cells(i, 6).FormulaR1C1 = "=EDS_Value(" & Cell & ", RC[-1])"
i = i + 1

Next Cell
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Is "Master Tag" the name of a range on a worksheet?

Variable i is not initialized (or declared) so its initial value is 0; there is no row 0.

You have a For loop that doesn't use the loop variable (Cell)

What is the code supposed to do?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,203,521
Messages
6,055,880
Members
444,830
Latest member
Excelsmallbusinessmom

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