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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:54:59+00:00 2026-06-03T08:54:59+00:00

I’m working on a parser for use at work. Basically I have an excel

  • 0

I’m working on a parser for use at work. Basically I have an excel document full of rows of data that I need to parse through and store into a multidimensional array to work with.

Here is the code I have so far:

Dim a 
Dim iRows As Long 
Dim i As Integer 
Dim aArray() As Variant 

a = Array(2,3,4,5,6,9,10,14,19,21,23,25,29,38) 
iRows = ActiveWorkbook.Sheets(1).UsedRange.Rows.Count
ReDim aArray(iRows, UBound(a))

For i = 2 To iRows + 1 
    For x = 0 To UBound(a) 
        aArray(i - 2, x) = ActiveSheet.Cells(i, a(i - 2)).Value 
    Next x 
Next i 

Keep in mind the offset of i = 2 and iRows + 1 is to ignore the header row

The problem is that when I attempt to output it I am finding that all the rows are the same so aArray(0,1) and aArray(1,1) are the same values which they should be different values from different rows of the excel file.

furthermore there should be 14 columns that I am storing per row but when i try to output any value past location 9 i get an out of range error like so

ActiveSheet.Cells(1, 1).Value = aArray(10, 0)
ActiveSheet.Cells(1, 2).Value = aArray(11, 0)

Based on the small array I am using to specify which values to store in the main array their should be 14 total locations for each sub array contain within aArray.

Any insights?

Keep in mind that this is my first real VBA script so if I am making mistakes please have patients with my I m coming from a JS/PHP background so this is a lot different for me.

  • 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-03T08:55:00+00:00Added an answer on June 3, 2026 at 8:55 am

    You switched the dimensions in aArray. In the code you redim and fill aArray with (count_of_rows_in_usedRang,count_of_elements_in_a) and I imagine used rang is just 9 lines, so aArray(10, 0) is out of range while aArray(0,10) wouldn’t be.

    I think there may be a similar problem with the output in the first part of your question. If not: please post, what is in the excel-sheet and what you got as a result.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.