Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
conditionally delete some elements from an array
I have an one-dimensional array that contains 11 elements. Now I only need 3 elements and want to discard the rest from the array. So my final array has only 3 elements. I need to code something like: for i=1 to hbound(myarray) if myarray ^in ('A, 'B', 'C') then delete next How to code it though? Thanks! ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
conditionally delete some elements from an array
Clui wrote:
I have an one-dimensional array that contains 11 elements. Now I only need 3 elements and want to discard the rest from the array. So my final array has only 3 elements. I need to code something like: for i=1 to hbound(myarray) if myarray ^in ('A, 'B', 'C') then delete next Easiest is to create a new array with the content that you require. Or, if it is a dynamic array then you could move the items you want to the first 3 elements and ReDim Preserve MyArray(1 To 3) Bill Manville MVP - Microsoft Excel, Oxford, England No email replies please - reply in newsgroup |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conversion of Array Elements to PerCent | Excel Discussion (Misc queries) | |||
Use formulas for array elements | Excel Discussion (Misc queries) | |||
Reference Elements w/in an Array | Excel Discussion (Misc queries) | |||
Non-unique elements in an array | Excel Discussion (Misc queries) | |||
Q: Better syntax to cycle through elements of an array? | Excel Programming |