YasserKhalil
Well-Known Member
Hello everyone
I have the first row with some headers in about 12 columns and I need to search for specific headers from 1d array.
The code works and reorders the headers into two new 1d arrays the array s() and the array t() then I am using this line to get a final 1d array with the new order I desire
Is there a smarter approach to get the same result of the final 1d array??
The question posted here too
I have the first row with some headers in about 12 columns and I need to search for specific headers from 1d array.
Code:
a = Array("Header3", "Header5", "Header10")
For Each c In Range("A1").CurrentRegion.Rows(1).Cells
x = Application.Match(c.Value, a, 0)
If Not IsNumeric(x) Then
ReDim Preserve s(n)
s(n) = c.Column
n = n + 1
Else
ReDim Preserve t(k)
t(k) = c.Column
k = k + 1
End If
Next c
The code works and reorders the headers into two new 1d arrays the array s() and the array t() then I am using this line to get a final 1d array with the new order I desire
Code:
ar = Split(Join(s, ",") & "," & Join(t, ","), ",")
Is there a smarter approach to get the same result of the final 1d array??
The question posted here too
Reorder headers and store into 1d array - Eileen's Lounge
www.eileenslounge.com