Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Array trouble

*********************
Dim HeadingsToSync As Variant

HeadingsToSync = Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y
**********************

Why the duce doesnt y display anything other than 0?

Sincerely,
Arturo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Array trouble

you should probably dim y as an integer and then msgbox HeadingsToSync(y)


"Arturo" wrote:

*********************
Dim HeadingsToSync As Variant

HeadingsToSync = Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y
**********************

Why the duce doesnt y display anything other than 0?

Sincerely,
Arturo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Array trouble

It is showing 0,1,2,3,4,5 for me one at a time.

Do you really want to show the array index?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Arturo" wrote in message
...
*********************
Dim HeadingsToSync As Variant

HeadingsToSync = Array("1", "2", "3", "ABC", "ABC %Total", "123ABC /
321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y
**********************

Why the duce doesn't y display anything other than 0?

Sincerely,
Arturo



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Array trouble

This:

Option Explicit
Sub testme()
Dim HeadingsToSync As Variant
Dim y As Variant

HeadingsToSync _
= Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y

End Sub

showed:
0, 1, 2, 3, 4, 5
for me.

And did you really mean to show the index?

Maybe:

Option Explicit
Sub testme()
Dim HeadingsToSync As Variant
Dim iCtr As Long

HeadingsToSync _
= Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For iCtr = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox HeadingsToSync(iCtr)
Next iCtr

End Sub

And I got to see the headers.

This also showed the headers:

Option Explicit
Sub testme()
Dim HeadingsToSync As Variant
Dim myElement As Variant

HeadingsToSync _
= Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For Each myElement In HeadingsToSync
MsgBox myElement
Next myElement
End Sub


Arturo wrote:

*********************
Dim HeadingsToSync As Variant

HeadingsToSync = Array("1", "2", "3", "ABC", "ABC %Total", "123ABC / 321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y
**********************

Why the duce doesnt y display anything other than 0?

Sincerely,
Arturo


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Array trouble

testing to see the value

"Bob Phillips" wrote:

It is showing 0,1,2,3,4,5 for me one at a time.

Do you really want to show the array index?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Arturo" wrote in message
...
*********************
Dim HeadingsToSync As Variant

HeadingsToSync = Array("1", "2", "3", "ABC", "ABC %Total", "123ABC /
321CBA")

For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)
MsgBox y
Next y
**********************

Why the duce doesn't y display anything other than 0?

Sincerely,
Arturo




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
Trouble with Array multiple return formula Kate Excel Discussion (Misc queries) 4 September 29th 09 04:38 PM
Trouble Passing An Array Kevin O'Neill[_2_] Excel Programming 3 January 6th 06 06:25 PM
Trouble shooting#NA error in Array formula RonR Excel Discussion (Misc queries) 2 June 14th 05 09:58 PM
Trouble increasing the array number and capacity? J_J[_2_] Excel Programming 16 March 24th 05 04:39 AM
Trouble to sort an array in Excel using VBA choco140 Excel Programming 1 August 15th 03 07:24 AM


All times are GMT +1. The time now is 05:10 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"