Re: array help needed

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You show 'add.item loop' in your latest post... exactly what are you planning to add your array elements to? While the syntax you posted is incorrect for my guess of a ListBox or ComboBox; however, if that is indeed what you want to populate, you do not need to load up an array first in order to do it. Consider this example for a ListBox on a UserForm (same code for a ComboBox except for the control's name, of course)...

Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(.Rows.Count, "BE").End(xlUp).Row
Me.ListBox1.RowSource = "BE6:BE" & LastRow
End With

If my guess was correct and if you have trouble adapting my code, tell us what control you have, where it is located (UserForm or Worksheet) and, if directly on a worksheet, which toolbar you got it from.

--
Rick (MVP - Excel)


"Rivers" <Rivers@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:6D53B28E-4D14-4DD4-9F30-E8298A4D3CEB@xxxxxxxxxxxxxxxx
sorry but i donot understand how to use this array.

my cell values store spreadsheet names and i wish to store them all in the
variable and then call them into a

add.item loop

can you please explain how i can do this a seriously stuck with your answer

"shg" wrote:


Code:
--------------------
Dim vArr As Variant
vArr = Range("BE6", Range("BE6").End(xlDown)).Value

--------------------


--
shg
------------------------------------------------------------------------
shg's Profile: http://www.thecodecage.com/forumz/member.php?userid=13
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=24240



.



Relevant Pages

  • Re: New style DO syntax?
    ... Joe Krahn wrote: ... I think that the DO-loop is the only "block construct" that does not contain the 'expression/attribute' part in parenthesis. ... Using parenthesis for delimiters should also allow for using array elements as do iterators. ... Capture the value of I at loop start and use that for ...
    (comp.lang.fortran)
  • Re: Word counting
    ... length so increment our word length to search for by 1. ... Loop through our array elements and hopefully we'll have the words ... This is an example input file ...
    (comp.lang.ada)
  • Re: converting .dat file to array
    ... array elements corresponding to indices greater than the number of data ... According to the standard, ... The actual behavior is compiler dependent. ... You need to so something with a loop, ...
    (comp.lang.fortran)
  • Re: Changing the name of a variable using code
    ... (The function would have to loop through the entire array looking for X, ... This would allow you to access the array elements much like the elements of ... It may be a coin toss depending on what you are doing. ... column is a name of a variable and the second column is the value of ...
    (microsoft.public.excel.programming)
  • Re: Highlighting certain line
    ... know if I should put it in the loop part. ... When I try to specify I ... dtxt = to_date); ...
    (comp.soft-sys.matlab)