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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,225,055
Messages
6,182,587
Members
453,126
Latest member
NigelExcel

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