Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Why not working? Array Problem.

Private Sub CommandButton1_Click()
Dim AbcID(1 To 100) As String
Dim iAbc As Integer
Dim AbcSheetName(1 To 100) As String

For iAbc = 1 To 10
AbcID(iAbc) = 5
''AbcID(iAbc) = Sheets("Data").Range("D" & iAbc + 5).Value
''AbcSheetName(iAbc) = Sheets("Data").Range("E" & iAbc + 5).Value
Next iAbc

End Sub

I was expecting AbcID(1), AbcID(2), ......

But it is always AbcID(iAbc), AbcID(iAbc)why...

Please help me....

Thanks
musa.biralo

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Why not working? Array Problem.

Remove the quote from ''AbcID(iAbc) and ''AbcSheetName(iAbc).

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Why not working? Array Problem.

i add those just to give you what am i actually trying ...i know quote
is for commenting...
thanks anyway though.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Why not working? Array Problem.

musa.biralo,
It works for me on XL 97 and it works the same whether
the "AbcID(iAbc) = 5" line in included or not.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"musa.biralo"
wrote in message
Dim AbcID(1 To 100) As String
Dim iAbc As Integer
Dim AbcSheetName(1 To 100) As String

For iAbc = 1 To 10
AbcID(iAbc) = 5
''AbcID(iAbc) = Sheets("Data").Range("D" & iAbc + 5).Value
''AbcSheetName(iAbc) = Sheets("Data").Range("E" & iAbc + 5).Value
Next iAbc

End Sub

I was expecting AbcID(1), AbcID(2), ......
But it is always AbcID(iAbc), AbcID(iAbc)why...
Please help me....
Thanks
musa.biralo

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Example from Help also not working.

Sub FillArray()
Dim curExpense(364) As Currency
Dim intI As Integer
For intI = 0 To 364
curExpense(intI) = 20 + intI
Next
End Sub

this part is not running either ....why why why...i have no clue why
this is not running on my computer...

Please let me know if it runs on your's.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Example from Help also not working.

What do you mean it doesn't work?

There's nothing in your code that shows you checked how it worked.

I could see that it worked by running this and looking at the immediate window
(ctrl-g in the VBE):

Option Explicit
Sub FillArray()
Dim curExpense(364) As Currency
Dim intI As Integer
For intI = 0 To 364
curExpense(intI) = 20 + intI
Next intI

For intI = LBound(curExpense) To UBound(curExpense)
Debug.Print intI & "--" & curExpense(intI)
Next intI

End Sub

"musa.biralo" wrote:

Sub FillArray()
Dim curExpense(364) As Currency
Dim intI As Integer
For intI = 0 To 364
curExpense(intI) = 20 + intI
Next
End Sub

this part is not running either ....why why why...i have no clue why
this is not running on my computer...

Please let me know if it runs on your's.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Example from Help also not working.

i totally agree with you it should run like this..

For intI = 0 To 364
curExpense(intI) = 20 + intI
Next

You should get somethinglike
curExpense(0) = 21
curExpense(1) = 22
curExpense(2) = 23
..
..
..
.....
....
What i am seeing when i do the watch window or bookmark and see the
value..i found...something like this...

curExpense(intI) = 20
curExpense(intI) = 21
curExpense(intI) = 22
curExpense(intI) = 23
..
..
..

i don't know why "intl" is not replaced by 0,1,2...and this is the
main problem to me....

musa.biralo


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Example from Help also not working.

The same reason that the whole expression isn't replaced by 21 or 21 or 22 or
....

Just add another watch for iintI and you'll see that it changes, too.

"musa.biralo" wrote:

i totally agree with you it should run like this..

For intI = 0 To 364
curExpense(intI) = 20 + intI
Next

You should get somethinglike
curExpense(0) = 21
curExpense(1) = 22
curExpense(2) = 23
.
.
.
....
...
What i am seeing when i do the watch window or bookmark and see the
value..i found...something like this...

curExpense(intI) = 20
curExpense(intI) = 21
curExpense(intI) = 22
curExpense(intI) = 23
.
.
.

i don't know why "intl" is not replaced by 0,1,2...and this is the
main problem to me....

musa.biralo


--

Dave Peterson
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
3d array not working D Excel Worksheet Functions 3 November 2nd 07 03:36 PM
array formula(s)- not working, need some help please (problem with an 'AND') KR Excel Worksheet Functions 7 July 5th 06 05:00 PM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM
Working with an array Otto Moehrbach Excel Programming 2 September 6th 05 10:37 PM


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