Adding a sheet reference to each range in a union

Kaelen

New Member
Joined
Jul 28, 2010
Messages
21
Hey all so I have a range object defined that was created from a union of a variable number of other range objects. This union is then supposed to go into a formula; however, the way I have it set up now the sheet reference only appears in front of the first range in the union. I need it to be in front of all of the ranges in the union. Here is the line of code.


Cells(3 + ((j - 1) * 2), 3 + (a * 5)).Formula = "=AVERAGE(" & allneck(j).Parent.name & "!" & allneck(j).Address & ")"

Thanks a lot.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Where's the range?

What's allneck(j)?
 
Upvote 0
Sorry, "allneck" is a dynamic range variable.

I actually found a way to get around this problem by making allneck into a string variable. The loop that used to take each of the elements in another range variable called "neck" and union them into "allneck" now just concatenates their addresses into a single string instead.
 
Upvote 0

Forum statistics

Threads
1,203,174
Messages
6,053,928
Members
444,694
Latest member
JacquiDaly

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