ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Within VB, how to pass results of a FormulaArray to a variable. (https://www.excelbanter.com/excel-programming/357146-within-vbulletin-how-pass-results-formulaarray-variable.html)

Tim

Within VB, how to pass results of a FormulaArray to a variable.
 
I am working with a series of matrices. I want to load the first matrix with
constants. I know how to do that. I then want to use some functions like
MMULT and MINVERSE and put the results (sometimes one number, sometimes a
matrix) into an object where I can reference the value in a subsequent matrix
operation. When I merely dimension an array, I can't seem to pass the
results of a matrix function to that array or use the array within a matrix
function.

On a similar issue with arrays, I have a project where I want to delete
mutliple sheets based upon some selection criteria. I could do it one at a
time, but it gets annoying answering the question "Do you want to delete".
Therefore I'd like to delete and array of sheets. When I record the action
of grouping sheets and then deleting them, I notice it uses
"Array(sheet1,sheet2,sheet3)". Is there a way I can load an array with the
sheets I want to delete and then issue one delete statement?

JMB

Within VB, how to pass results of a FormulaArray to a variable.
 
With regards to deleting sheets, yes you can delete them in one go and you
can prevent the "Are you Sure" from popping up by disabling alerts (then
enabling after you've deleted the sheets).

Application.DisplayAlerts = False
Sheets(Array("Sheet3", "Sheet4")).Delete
Application.DisplayAlerts = True

"Tim" wrote:

I am working with a series of matrices. I want to load the first matrix with
constants. I know how to do that. I then want to use some functions like
MMULT and MINVERSE and put the results (sometimes one number, sometimes a
matrix) into an object where I can reference the value in a subsequent matrix
operation. When I merely dimension an array, I can't seem to pass the
results of a matrix function to that array or use the array within a matrix
function.

On a similar issue with arrays, I have a project where I want to delete
mutliple sheets based upon some selection criteria. I could do it one at a
time, but it gets annoying answering the question "Do you want to delete".
Therefore I'd like to delete and array of sheets. When I record the action
of grouping sheets and then deleting them, I notice it uses
"Array(sheet1,sheet2,sheet3)". Is there a way I can load an array with the
sheets I want to delete and then issue one delete statement?



All times are GMT +1. The time now is 03:30 AM.

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