Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why not working? Array Problem.
Remove the quote from ''AbcID(iAbc) and ''AbcSheetName(iAbc).
Hth, Merjet |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
3d array not working | Excel Worksheet Functions | |||
array formula(s)- not working, need some help please (problem with an 'AND') | Excel Worksheet Functions | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Working with an array | Excel Programming |