+ Reply to Thread
Results 1 to 4 of 4

Transfer ListObject to Array ---> array subscripts default to base 1?

  1. #1
    Registered User
    Join Date
    09-27-2021
    Location
    Washington, DC
    MS-Off Ver
    365 (64 bit)
    Posts
    11

    Question Transfer ListObject to Array ---> array subscripts default to base 1?

    Question regarding this example from book Power Programming with VBA Excel 2019, which portrays matching items in a UserForm ListBox to the text in a TextBox, then filtering the ListBox accordingly.

    It seems that after transferring the values of the DataBodyRange of the excel table "tblContacts" to a variant/dynamic array variable, the subscripts of the array elements are defaulting to Base 1 instead of Base 0, seemingly without an explicit Option Base 1 instruction.

    Using function LBound in the immediate window verifies Base 0. Am I missing something?


    Please Login or Register  to view this content.
    Last edited by hic24; 01-15-2022 at 06:01 PM.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: Transfer ListObject to Array ---> array subscripts default to base 1?

    Whenever you load an array from a range the LBound will be 1 regardless of what Base you are using.
    Likewise when you use Split to create an array it will always be 0 based even if you use Option Base 1

  3. #3
    Registered User
    Join Date
    09-27-2021
    Location
    Washington, DC
    MS-Off Ver
    365 (64 bit)
    Posts
    11

    Re: Transfer ListObject to Array ---> array subscripts default to base 1?

    Thank you so much for clearing that nuance up. I'm sure I've come across it in previous chapters of the book and it probably fled my mind.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: Transfer ListObject to Array ---> array subscripts default to base 1?

    You're welcome & thanks for the feedback.

+ 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. Adding single listobject, selected Columns[Name] to an array
    By sabooru in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2020, 08:09 AM
  2. Vlookup Base table array on cell value
    By Mark1120 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-18-2019, 04:19 PM
  3. How to get listobject name from array string with range inside?
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2019, 03:26 AM
  4. Load Values To Array Using .CurrentRegion With Array Base 0
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2016, 07:53 AM
  5. How to turn Listobject into an Array
    By shawnvw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-07-2015, 01:07 AM
  6. [SOLVED] Array base
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-19-2013, 04:54 AM
  7. Runtime error '9'. Subscripts out of range - Dynamic array
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2007, 05:38 PM

Tags for this Thread

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