Printing contents of an array into a message box

A

Alex_Rodriguez

Hi,

Currently, I am working through some basic examples given on this
website: http://www.anthony-vba.kefra.com/index_011.htm. When I tried
the first example in Excel VBA Basic Tutorial 3, ie:


Option Base 1
Sub assignArray( )
Dim Arr(5)


Arr(1) = "Jan"
Arr(2) = "Feb"
Arr(3) = "Mar"
Arr(4) = "Apr"
Arr(5) = "May"


Msgbox Arr(1) & "-" & Arr(2) & "-" & Arr(3) & "-" &
Arr(4) & "-" & Arr(5)
End Sub


I ended up with: ---- in the message box, rather than: Jan-Feb-
Mar-Apr-May


What do I need to do in order to correct this?


Cheers,


Alex
 
D

Dave Peterson

I copied and pasted into the code window. Fixed the line wrap problem and ran
your code.

It worked fine.

Maybe this isn't the same code that failed???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top