Hemant_india said:
i want to delete certain array elements
e.g.
dim arr(100)
deleted arr(87)
redim preserve arr(100-n) ' n= number of elements i deletd
any ideas?
If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook,
To remove elements 45, 68 and 87, and resize
n1 = 45
n2 = 68
n3 = 87
arr2 = MakeArray(SubArray(arr, 1, n1 - 1), SubArray(arr, n1 + 1, _
n2 - 1), SubArray(arr, n2 + 1, n3 - 1), SubArray(arr, n3 + 1, 100), 1)
Or, it it helps you to visualize more readily what's happening
Sarr1 = SubArray(arr, 1, n1 - 1)
Sarr2 = SubArray(arr, n1 + 1, n2 - 1)
Sarr3 = SubArray(arr, n2 + 1, n3 - 1)
Sarr4 = SubArray(arr, n3 + 1, UBound(arr))
arr2 = MakeArray(Sarr1, Sarr2, Sarr3, Sarr4, 1)
Alan Beban