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

  • Home
  • SEARCH
  • 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 9030111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:24:30+00:00 2026-06-16T07:24:30+00:00

CODE height = objExcel1.Application.WorksheetFunction.CountA(ob3.Columns(1)) ‘MsgBox(height) ReDim dataArray(height – 2, 0) ‘ -1 for 0

  • 0

CODE

    height = objExcel1.Application.WorksheetFunction.CountA(ob3.Columns(1))
    'MsgBox(height)
    ReDim dataArray(height - 2, 0) ' -1 for 0 index, -1 for the first row as header row, excluded
    str = ""
    dataArray = ob3.Range(ob3.Cells(2, 1),ob3.Cells(height, 1)).Value
    Set d = CreateObject("scripting.dictionary")
    'MsgBox(LBound(DeletArr) & ":" & UBound(DeletArr))
    For i = LBound(DeletArr) To UBound(DeletArr)
        If Not d.exists(DeletArr(i)) Then
            d(DeletArr(i)) =  0
        End If
    Next
    MsgBox(LBound(dataArray,1) & ":" & UBound(dataArray,1))
    For i = LBound(dataArray, 1)  To UBound(dataArray, 1) - 1

        If d.exists(dataArray(i, 1)) Then

            str = str & (i+1) & ":" & (i+1) & ","
            'ob3.Range(i & ":" & i).Delete

        Else
            'found = False
        End If

    Next

VBScript Array is 0 based. But why LBound(dataArray,1) is giving starting subscript is 1,why not 0? Ubound is giving the number – against which i am bit confused is it the last subscript of the array or the size?

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-16T07:24:32+00:00Added an answer on June 16, 2026 at 7:24 am

    By default, the subscripts/indices of VBA arrays start at 0 (this is called the lower bound of the array) and run up to the number you specify in the Dim statement (this is called the upper bound of the array). If you would prefer your array index numbers to start at 1, include the following statement at the top of the module.

    Option Base 1

    enter image description here

    However when an array is populated by Range object using the Transpose method, the array Lower bound set to 1 even you are on default Zero baed mode. So array becomes 1 based.

    e.g. the following data is added using Transpose method.

    Array(1) = "Hola"
    Array(2) = "Bonjour"
    Array(3) = "Hello"
    Array(4) = "Wei"
    

    Good thing is that this array UBound tells you number of elements (4) which = UBound. Unlike if it was zero based, then number of elements = Ubound + 1.

    UBound(Array) --> 4
    LBound(Array) --> 1
    

    In current 1-based scenario, the Ubound refers to the total number of elements. So in such cases you need to amend your code to track data within the array’s LBound, UBound properties to avoid data loss.

    And by the way, by adding Option Base 0 doesn’t stop array being dimentioned to 1 based by Transpose method. Which invalids my first comment.

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

Sidebar

Related Questions

I used following JS code to create equal height columns: var colHeight = Math.max($('.3columngallery
I use this code to determine checkbox width and height: var chk = $('input[type=checkbox]:first');
I am using this relatively simple code: var height = help ? 'minus' :
I have the following code and instead of height(300), height() = document height-100 $(.bar).height(XXX);
How to change the width/height if I have the following code and using php:
I am setting the row height of my UITableView using following code [tableView setRowHeight:
The code like this: $(.hide).click(function(){ $(.online-contact).animate({width: 'toggle',height: '100%'}, fast); $(this).hide(); $(.show-class).show(); }) I want
My jQuery code: $(document).ready(function() { chrome.extension.sendRequest({get: height}, function(response) { height = response.value; }); $(#id).css(height,
I've looked in the gtk source code and the header height is private. I've
my CSS code .child{ width:100px; height:100px; display:inline-block; } my HTML code <div id=parent> <div

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.