arraysexcelvba

What is the difference of Array("2023","2024","2025") and Array("2023,2024,2025") and Array(2023, 2024, 2025) in Excel VBA


I have this in my code:

Dim cYear() As Variant

I am not so sure what to code next. Should it be like this:

cYear = Array("2023","2024","2025")

or

cYear = Array("2023,2024,2025")

or

cYear = Array(2023, 2024, 2025)

Please advise. Thank you..


Solution

  • Array("2023","2024","2025")
    

    is an array of three strings.

    Array("2023,2024,2025")
    

    is an array of one string.

    Array(2023, 2024, 2025)
    

    is an array of three integers.