+ Reply to Thread
Results 1 to 4 of 4

Question about variant arrays

  1. #1
    Forum Contributor
    Join Date
    08-05-2009
    Location
    Colorado Springs, CO
    MS-Off Ver
    Office 365
    Posts
    161

    Question about variant arrays

    Please Login or Register  to view this content.
    Question:
    1. Why does Arr get populated as a 1 d array beginng at zero, while Arr1 is treated as a 2d array beginning at 1?

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Question about variant arrays

    Can't answer why setting a range begins index at 1, but I guess that's how it is defaulted as. Ranges are always 2D since they have rows and columns.

    The array returned from Split function is always 1D.
    Split Function

    Description

    Returns a zero-based, one-dimensional array containing a specified number of substrings.
    The beginning index can be controlled by Option Base statement. If you want it to start from 1, do this:
    Please Login or Register  to view this content.

    Option Base Statement

    Used at module level to declare the default lower bound for array subscripts.

    Syntax

    Option Base {0 | 1}
    Last edited by millz; 09-20-2016 at 10:28 PM.
    多么想要告诉你 我好喜欢你

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,565

    Re: Question about variant arrays

    Split/Filter function will never be affected by Option Base statement.

    It always return 0 based 1 d string array.

    However, Array function will be affected.

    When you load Range to an array variable, it must be Variant type and always 1 based 2 d array.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Question about variant arrays

    Quote Originally Posted by jindon View Post
    Split/Filter function will never be affected by Option Base statement.
    Right, I stand corrected; it's right there in the description of the function and I missed it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Run SQL queries on 2d variant arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-07-2021, 06:55 AM
  2. [SOLVED] Variant Arrays and Ranges of Data
    By NatalieEC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2014, 06:08 PM
  3. [SOLVED] Error checking for Variant Arrays?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2013, 05:49 AM
  4. Conditional rank in VBA, using Variant arrays
    By nchmy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 01:55 PM
  5. [SOLVED] Arrays question
    By Alexander_Golinsky in forum Excel General
    Replies: 14
    Last Post: 05-13-2012, 07:03 AM
  6. A question about arrays.
    By Alexander_Golinsky in forum Excel General
    Replies: 0
    Last Post: 05-12-2012, 12:26 PM
  7. [SOLVED] Worksheet names to variant arrays
    By Alasdair Stirling in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1