Range question needs explanation

lillypop

New Member
Joined
Jul 20, 2018
Messages
14
Hello

I need to 'de-code' someone else's left over codes..and have come across this line


Range(Range("Outcome"), Range("Outcome").Offset(UBound(meanoutput, 1), UBound(meanoutput, 2))) = meanoutput

I suppose that I will need to replace "Outcome" with something else, but first I will need to understand what this means. Any idea? Range(Range("Outcome"), Range("Outcome")
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I think the first thing you should check for is a named range called 'Outcome'.

That's what appears to be a major part of this.

The second thing you need to look at is, what I presume is an array, meanoutput.
 
Upvote 0
meanoutput must be an array.
Outcome must be a named range on the worksheet, probably 1 cell.

UBound(meanoutput, 1) returns the number of rows in meanoutput

UBound(meanoutput, 2) returns the number of columns in meanoutput

Range("Outcome").Offset(r, c) points to the cell that is r rows down and c columns across from the upper left cell of Outcome.

Range(Cell1, Cell2) creates a range object with the upper left corner at Cell1, and the bottom right corner at Cell2.


So when you put it all together, that line puts the entire contents of meanoutput to the worksheet, starting at the upper left corner of a named range called Outcome.
 
Upvote 0

Forum statistics

Threads
1,215,102
Messages
6,123,097
Members
449,096
Latest member
provoking

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