Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Array/Matrix

If you want to copy and paste, you should just use the copy and paste
methods, and not worry about matrices. But if you need a dynamic
matrix, I think you should look into "Redim Preserve". Redim will
"Dim" the variable with new subscripts. For example,

Dim var (10) as long
[Use var in code. Decide that you need more than 10 long words]
Redim var (20) as long

The Redim has changed the size of the array. Unfortunately, it has
also lost the 10 values in the previous array. To save these use the
"Preserve" keyword:

Dim var (10) as long
[Use var in code. Decide that you need more than 10 long words]
Redim Preserve var (20) as long

Now, var has changed size, and the first 10 values remain unchanged.

The order of the subscripts is important in a matrix. If you are going
to change a matrix, change only the last subscript. For example:

Dim Mat (10, 5) as long
[Use var in code. Decide that you need more than 10 long words]
Redim Preserve Mat (10, 10) as long

Hope this helps,
Dom



Egon wrote:
I need help setting up an array to read data into.

I would like to read data from 3 columns on one sheet into an array and
then copy that information into another sheet.

The Array/Matrix will be 3 columns wide, but the number of rows will
need to be dynamic.

Can anyone help?

TIA
E


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Array/Matrix

My problem is that I don't want to copy and paste because the data that
is being copied is in different locations throughout the spread sheet.
This is what we are trying to make easier for some people now. Some
rows have data that needs to be copied, some rows do not. I need to be
able to copy only the rows that are bold, filtering out 3 columns in
the source, and pasting into a new worksheet so that it can be set off
as a report each week.

Thanks.
E

wrote:
If you want to copy and paste, you should just use the copy and paste
methods, and not worry about matrices. But if you need a dynamic
matrix, I think you should look into "Redim Preserve". Redim will
"Dim" the variable with new subscripts. For example,

Dim var (10) as long
[Use var in code. Decide that you need more than 10 long words]
Redim var (20) as long

The Redim has changed the size of the array. Unfortunately, it has
also lost the 10 values in the previous array. To save these use the
"Preserve" keyword:

Dim var (10) as long
[Use var in code. Decide that you need more than 10 long words]
Redim Preserve var (20) as long

Now, var has changed size, and the first 10 values remain unchanged.

The order of the subscripts is important in a matrix. If you are going
to change a matrix, change only the last subscript. For example:

Dim Mat (10, 5) as long
[Use var in code. Decide that you need more than 10 long words]
Redim Preserve Mat (10, 10) as long

Hope this helps,
Dom



Egon wrote:
I need help setting up an array to read data into.

I would like to read data from 3 columns on one sheet into an array and
then copy that information into another sheet.

The Array/Matrix will be 3 columns wide, but the number of rows will
need to be dynamic.

Can anyone help?

TIA
E


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matrix Math using LOOKUP inside Array {} Function ExcelMonkey Excel Worksheet Functions 4 February 15th 07 11:10 PM
Matrix/array question cursednomore Excel Discussion (Misc queries) 0 November 9th 05 08:09 PM
mirrored array/matrix hierarchii Excel Discussion (Misc queries) 3 August 5th 05 09:35 AM
How to use an array or matrix to return text vs. numeric values Ingrid Excel Worksheet Functions 2 April 10th 05 12:51 AM
Lookup of sorts...Matrix Array etc. Michele[_2_] Excel Programming 5 February 14th 04 10:24 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"