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 7788353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:58:22+00:00 2026-06-01T20:58:22+00:00

In my VBA program, I have a big array of data, where I need

  • 0

In my VBA program, I have a big array of data, where I need to constantly use its sub-arrays.

My method is:

Redim subArr(rowBegin to rowEnd)
For r = rowBegin to rowEnd
    subArr(r) = bigArr(r)
Next r

Is there any more efficient way to reference this kind of sub-arrays please? Thanks…

  • 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-01T20:58:23+00:00Added an answer on June 1, 2026 at 8:58 pm

    Working with arrays is incredibly fast so this will probably give no discernable benefit – althouh I can understand how it may appeal from a coding sense than looping to fill a smaller array

    Given you are working with a single element array you could:

    1. Introduce a “marker” string inside the large array
    2. Join the large array with a delimiter into a single string
    3. Split the large array by the “marker” string, then separate the reduced string into a smaller array with the delimiter

    The code below dumps the numbers 1 to 100 into an array, and then splits it as above to pull out the first 10 records

    Sub test()
    Dim bigArr
    Dim subArr
    Dim strSep As String
    Dim strDelim As String
    Dim strNew As String
    Dim rowBegin As Long
    Dim rowEnd As Long
    
    strDelim = ","
    strSep = "||"
    'fill array with 1 to 100
    bigArr = Application.Transpose(Application.Evaluate("row(1:100)"))
    
    rowBegin = 1
    rowEnd = 10
    
    bigArr(rowEnd + 1) = strSep
    'make a single string
    strNew = Join(bigArr, strDelim)
    'split the string at the marker 
    vArr = Split(strNew, strSep)
    ReDim subArr(rowBegin To rowEnd)
    'split the smaller string with the desired records
    subArr = Split(Left$(vArr(0), Len(vArr(0)) - 1), strDelim)
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to be able to SFTP though VBA. I have an Access program
As part of a VBA program, I have to set the background colors of
I have a VBA program to download attachments from a Mail Item. I launch
I have not had much experience with VBA, but I sometimes use it at
When I program in Excel-VBA I use Hungarian notation. Worksheet variables start with ws,
Just as the title goes. I have a python program which processes some data
we have subscription to Bloomberg data, we use excel to load data from bloomberg
I have an Excel 2003 VBA program that creates an SQL string that way:
I have a program that uses a Microsoft Access database for its back-end. I
I have a massive program written with VBA and cell formulas. I am tasked

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.