Rearrange 1d array in an easier way

YasserKhalil
PlatinumLounger
Posts: 4912
Joined: 31 Aug 2016, 09:02

Rearrange 1d array in an easier way

Post by YasserKhalil »

Hello everyone
I have a1d array, say x=Array("A","B","C","D","E")
How can I move the fourth item in the 1d array which is "D" to be the first item like that

D
A
B
C
E

YasserKhalil
PlatinumLounger
Posts: 4912
Joined: 31 Aug 2016, 09:02

Re: Rearrange 1d array in an easier way

Post by YasserKhalil »

I found the solution

Code: Select all

x = Application.Index(x, 1, [{4,1,2,3,5}])