ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   union method for non-adjacent ranges (https://www.excelbanter.com/excel-programming/277149-re-union-method-non-adjacent-ranges.html)

Tom Ogilvy

union method for non-adjacent ranges
 
To the best of my recollection
MMULT is limited to matices with about 73 rows and 73 columns. MINVERSE is
about 52 rows x 52 columns.

Anyway, it is a lot less than 256 columns.

Union will create a reference to non-adjacent ranges, but it doesn't make
them into a single area.

--
Regards,
Tom Ogilvy

"felix" wrote in message
...
Hi there,

I am trying to combine two non-adjacent ranges. The
resulting range shall then be multiplied with another
range created the same way using the mmult worksheet
function.
However, apparently the union statement cannot combine non-
adjacent ranges, but only adjacent ranges.
I am running into this problem because I need to perform
matrix calculations with a matrix exceeding the 256
columns a worksheet provides.

Any help will be greatly appreciated!
Felix

Code

Note: a and cd are column ranges, b and ef are row ranges

Dim Result As Range
Set Result = Range("Result")
Dim a, b, cd, ef, acd, bef As Variant

Set a = Range("a")
Set b = Range("b")
Set cd = Range("cd")
Set ef = Range("ef")

acd = Union(a, cd)
bef = Union(b, ef)

Result = Application.WorksheetFunction.MMult(bef, acd)

End Sub





All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com