Saqib Husain
asked on
Reducing an array
I have an array of data read off a worksheet using the statement
maxrds = dta.Range("a" & xls.Application.Rows.Count ).End(xlUp ).Row - datstart + 1
All variables are variants.
How can I create a similar array which has only even numbers in the first column?
Saqib
maxrds = dta.Range("a" & xls.Application.Rows.Count
All variables are variants.
How can I create a similar array which has only even numbers in the first column?
Saqib
ASKER
Hi, Dave,
I have not declared the size of the original array. It sizes it based on the assignment statement above. I would like to know a way to assign this to the new array without defining the length. So the main list might have 100 entries and the new list might have 70
The numbers would have to be checked for evenness, they are not regularly incrementing.
I have not declared the size of the original array. It sizes it based on the assignment statement above. I would like to know a way to assign this to the new array without defining the length. So the main list might have 100 entries and the new list might have 70
The numbers would have to be checked for evenness, they are not regularly incrementing.
ASKER
Sorry I had given the wrong assignment statement in the question. That was for calculation the number of entries in the range. The range assignment is given here
rds = WorksheetFunction.Transpos e(dta.Rang e(dta.Cell s(datstart , 1), dta.Cells(maxrds + datstart - 1, 1)).Value)
rds = WorksheetFunction.Transpos
Can you pls post a sample Saqib
ASKER
Dave,
I have created this file with the given numbers in column A.
In column D I have shown what values I would like to see in the reduced array. This column is not normally present.
I have also created a macro which assigns column A values to rds and column D values to rds2.
I would like to have rds contain the contents of rds2 instead of having a new variable rds2.
Saqib
Reducearray.xls
I have created this file with the given numbers in column A.
In column D I have shown what values I would like to see in the reduced array. This column is not normally present.
I have also created a macro which assigns column A values to rds and column D values to rds2.
I would like to have rds contain the contents of rds2 instead of having a new variable rds2.
Saqib
Reducearray.xls
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think you will need to create a second array reading in every second record from your initial array (faster than writing every second cell to a single array)
Cheers
Dave