ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   "Type mismatch" when I try to fill an Array variable with "+" (https://www.excelbanter.com/excel-discussion-misc-queries/139184-type-mismatch-when-i-try-fill-array-variable.html)

[email protected]

"Type mismatch" when I try to fill an Array variable with "+"
 
2007/2007

I am having a brain fart.


Dim myArray(1 to 2) as long

myArray(1) = "+" does not work

When I attempt the step above, I get a type mismatch.

I thought that arrays were like a Variable.

myArray(1) = 25 works fine

I know that one can initialize an array like array("a", "b")

Why can I not store a string to myArray(1)???


TIA EagleOne

Dave Peterson

"Type mismatch" when I try to fill an Array variable with "+"
 
If each element in myArray is a long, then "+" won't work. (Longs are whole
numbers.)

Maybe

Dim myArray(1 to 2) as Variant 'or string???



wrote:

2007/2007

I am having a brain fart.

Dim myArray(1 to 2) as long

myArray(1) = "+" does not work

When I attempt the step above, I get a type mismatch.

I thought that arrays were like a Variable.

myArray(1) = 25 works fine

I know that one can initialize an array like array("a", "b")

Why can I not store a string to myArray(1)???

TIA EagleOne


--

Dave Peterson


All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com