Main Page ┬╗ MS Excel Snippets ┬╗ Defining Array as Global Variable

Defining Array as Global Variable

Global variable means, once you define a global variable, then you can use it many times in different modules. Defining global variable as string or as integer are easy but defining as array is a bit difficult. I have learned this point while searching about this issue through internet.
At below you may examine simple and good working solution.

Public Const SomeProvincesOfTurkiye = "Ankara, Izmir, Istanbul, Antalya, Burdur, Usak, Sivas, Eskisehir, Kastamonu"
Sub WriteDown()
ProvincesSample = Split(SomeProvincesOfTurkiye, ",")
MsgBox ProvincesSample(6)
End Sub
'Message box will show "Sivas" as a result
End Sub

Please do not forget, you can call and use variable ÔÇťSomeProvincesOfTurkiyeÔÇŁ from other modules.