Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 391
Default Can one store a string in a Array element?

2003/2007

If I: Dim myArray(1 to 2) as long

myArray(1) = "+" does not work as I get a type mismatch.

I thought that array elements 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Can one store a string in a Array element?

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

Because you dimension myArray as *long*, not *string*

Dim myArray(1 to 2) As String
myArray(1) = "+"


In article ,
wrote:

2003/2007

If I: Dim myArray(1 to 2) as long

myArray(1) = "+" does not work as I get a type mismatch.

I thought that array elements 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to "return" the array element number in VBA EagleOne Excel Discussion (Misc queries) 4 December 12th 06 10:30 PM
store inventory sheet(ex:sports equipment store) vardan Excel Worksheet Functions 1 October 11th 06 12:51 AM
Search array and return element No Ron Excel Worksheet Functions 7 May 17th 06 05:27 AM
array functions and complex element values frustrated Excel Worksheet Functions 0 March 13th 06 11:44 PM
Permutations of an array element < to a value Bruce Excel Worksheet Functions 3 January 31st 06 04:00 PM


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"