Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Display an array in a MsgBox

Excel XP & Win XP
I have a variable array that could be ShtArray(a,b,c) or
ShtArray(d,e,f,g,h), etc. The number of elements in the array is also a
variable, as you can see.
In proofing my code I want to find out what array the code selected, so I
used:
MsgBox "ShtArray is: " & ShtArray
which errored out with a "Type Mismatch".
What code would I use to see the elements of the selected array?
I just want to see them at this point. I don't want to do anything with
them.
Thanks for your time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Display an array in a MsgBox

Hi Otto

You have to create a string with all elements from the array:

Dim MsgString As String
For i = LBound(ShtArray) To UBound(ShtArray)
If MsgString = "" Then
MsgString = ShtArray(i)
Else
MsgString = MsgString & ", " & ShtArray(i)
End If
Next
msg = MsgBox("ShtArray is: " & MsgString)

Regards,
Per

"Otto Moehrbach" skrev i meddelelsen
...
Excel XP & Win XP
I have a variable array that could be ShtArray(a,b,c) or
ShtArray(d,e,f,g,h), etc. The number of elements in the array is also a
variable, as you can see.
In proofing my code I want to find out what array the code selected, so I
used:
MsgBox "ShtArray is: " & ShtArray
which errored out with a "Type Mismatch".
What code would I use to see the elements of the selected array?
I just want to see them at this point. I don't want to do anything with
them.
Thanks for your time. Otto


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Display an array in a MsgBox

Thank you very much for that. Otto
"Per Jessen" wrote in message
...
Hi Otto

You have to create a string with all elements from the array:

Dim MsgString As String
For i = LBound(ShtArray) To UBound(ShtArray)
If MsgString = "" Then
MsgString = ShtArray(i)
Else
MsgString = MsgString & ", " & ShtArray(i)
End If
Next
msg = MsgBox("ShtArray is: " & MsgString)

Regards,
Per

"Otto Moehrbach" skrev i meddelelsen
...
Excel XP & Win XP
I have a variable array that could be ShtArray(a,b,c) or
ShtArray(d,e,f,g,h), etc. The number of elements in the array is also a
variable, as you can see.
In proofing my code I want to find out what array the code selected, so I
used:
MsgBox "ShtArray is: " & ShtArray
which errored out with a "Type Mismatch".
What code would I use to see the elements of the selected array?
I just want to see them at this point. I don't want to do anything with
them.
Thanks for your time. Otto




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 display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
Display Totals In MsgBox Pete[_4_] Excel Programming 0 June 6th 06 03:20 PM
display msgbox in order or one after the other harpscardiff[_5_] Excel Programming 1 October 20th 05 04:40 PM
MsgBox Display Michael S. Excel Programming 2 June 16th 05 10:55 PM
Display of $ in Msgbox David Excel Programming 2 September 8th 04 09:38 AM


All times are GMT +1. The time now is 02:36 PM.

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"