Always explicit declaring Option Base 0 or 1 is good coding
If You have 0 apples in real life it means You have no apples but this is not real life and it´s not about how many at all :wink:
If we have 4 apples we can name them in some kind of order like first, second... 0 or 1 based is used to index arrays. The use of 0-based indexing refers to assembly language and all the hardware starts with 0-based addresses.
So when JPG mention that VB.NET push for 0-based it means that MS accept the way things are in the computer-world
There shouldn´t be a need to check the LBound for arrays if we know the basic about arrays in XL. Reading data into arrays from sheets will always return a 1-based array even if we explict states Option Base 0 as the below case shows.
Option Explicit
Option Base 0
Sub Read_Data()
Dim rnData As Range
Dim vaData As Variant
Dim i As Long
Set rnData = Range("A1:A4")
vaData = rnData.Value
'Wrong way
For i = 0 To 3
'This will erase runtime error 9 - subscription out of range
'as the index 0 does not exist
Debug.Print vaData(i, 1)
Next i
'Right way
For i = 1 To 4
Debug.Print vaData(i, 1)
Next i
End Sub
Personally I use 0-based and 1-based where they are the most suitable. As the case shown above it is sometime difficult to use 0-based.
So where is the third option based on index start at 1 and second option based on indext start at 0.
I promise I won't make another analogy on this board.
You do
Take care,
Dennis