Dim ... As ... not working properly (VBA Excel) RRS feed

  • Question

  • Hi fellows,

    I wrote this:

    Dim Sentence1(), Sentence2() As String

    In the locals area I've got that Sentence1 is Dimed as a Variant and Sentece2 as a String.

    I am pretty much sure that I am not diming those arrays anywhere else.

    Why is this happening?  How can this be solved?



    Monday, November 23, 2015 8:47 AM

All replies

  • You have not specified a type for Sentence 1 so it defaults to variant.

    Replace your code with this

    Dim Sentence1() As String, Sentence2() As String

    Charles Excel MVP The Excel Calculation Site http://www.decisionmodels.com/

    Monday, November 23, 2015 10:57 AM