Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:24:17+00:00 2026-06-11T04:24:17+00:00

I have 10 values in column A of a excel spreadsheet (it will be

  • 0

I have 10 values in column A of a excel spreadsheet (it will be more) is there a way to take the values of the column and put them into an array?

And if possible would it be possible to put the values in a different order than they are in in the spreadsheet. For example, if my spreadsheet values are “Apple” “Orange” and “Banana”, then I would like my array to look something like, position 0 “Orange” position 1 “Banana” and position 2 “Apple”.

Does anybody know how this might be done? By the way, it needs to be scalable from 10 to 1000 values without editing the code much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:24:18+00:00Added an answer on June 11, 2026 at 4:24 am

    You can create an indexed array for a single column without looping as follows

    Sub GetArray()
    Dim X
    Dim lngCol As Long
    lngCol = Cells(Rows.Count, "A").End(xlUp).Row
    X = Application.Transpose(Application.Evaluate("If(row(A1:A" & lngCol & "),row(1:" & lngCol & ")-1 & A1:a" & lngCol & ",0)"))
    End Sub
    

    You didn’t post how you wanted to sort the data?
    enter image description here
    Udpated for random ordering

    Sub GetArray2()
    Dim X()
    Dim lngCol As Long
    lngCol = Cells(Rows.Count, "A").End(xlUp).Row
    X = Application.Transpose(Range("A1:A" & lngCol))
    Call ShuffleArrayInPlace(X())
    End Sub
    

    The next sub uses a modified version of Chip Pearson’s ShuffleArray

    Sub ShuffleArrayInPlace(InArray() As Variant)
    'http://www.cpearson.com/excel/ShuffleArray.aspx
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' ShuffleArrayInPlace
    ' This shuffles InArray to random order, randomized in place.
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        Dim N As Long
        Dim Temp As Variant
        Dim J As Long
    
        Randomize
        For N = LBound(InArray) To UBound(InArray)
            J = CLng(((UBound(InArray) - N) * Rnd) + N)
            If N <> J Then
                Temp = InArray(N)
                InArray(N) = InArray(J)
                InArray(J) = Temp
            End If
        Next N
          For N = LBound(InArray) To UBound(InArray)
          InArray(N) = N - 1 & " " & InArray(N)
          Debug.Print InArray(N)
          Next N
    End Sub
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel file with 10,000 rows in column A some values are
I have a query where I'm trying pivot row values into column names and
Is it possible to edit computed-column values? I have a computed-col in my table,
I know that using the following codes will make each column have unique values,
I have an excel spreadsheet that has dates in the first column, the rest
I have an excel spreadsheet with two columns. The first column is a label
In Excel 2010, I have a list of values in column A and a
I have an excel spreadsheet i am going to be turning into a DB
I am trying to solve copy pasting a column with values from excel into
I have a excel spreadsheet that contains a bunch of columns. My first column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.