VBA Option Base 1 question

antaeusguy

Board Regular
Joined
Mar 8, 2010
Messages
81
Hi

I wish to clarify the purpose of Option Base 1.

I now want the array Country() to contain only 12 elements.

If I've declared Option Base 1, then the ReDim would start at 1 and ends at 12.
Code:
Option Base 1
Sub Example1()
    Dim Country() As String
    ReDim Country(12)
End Sub

If I did not declare Option Base 1, then I would need to specify the ReDim so that it would start at 1 and ends at 12.
Code:
Sub Example1()
    Dim Country() As String
    ReDim Country(1 To 12)
End Sub

I would like to know if declaring both Option Base 1 and also in the ReDim to be unnecessary... that I just need to declare only one would do.
Code:
Option Base 1
Sub Example1()
    Dim Country() As String
    ReDim Country(1 To 12)
End Sub

Thanks in advance! :)
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hello antaeusguy,

The Option Base 1 statement will apply to all arrays delared in the module with that statement. Using either Dim or ReDim with the To statement will only change the base of that specific array.

Sincerely,
Leith Ross
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,848
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top