Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Add Dynamic Array to List Box

I would like to loop through a range and, for each cell whose value
does not equal the value of the cell offset(0,1), add the cell's value
to an array. Then, after completing the loop, I would like to show a
form with a list box containing the array just created.

Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Add Dynamic Array to List Box

Why not skip the array and load the listbox directly. Assuming your data
is in Columns A and B (Sheet1) with headers in row 1 then try:

Private Sub UserForm_Initialize()
Dim eRow As Long
Dim i As Long
With Sheets("Sheet1")
eRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To eRow
If .Cells(i, 1).Value < .Cells(i, 2).Value Then
Me.ListBox1.AddItem .Cells(i, 1).Value
End If
Next i
End With
End Sub

Hope this helps
Rowan

JG Scott wrote:
I would like to loop through a range and, for each cell whose value
does not equal the value of the cell offset(0,1), add the cell's value
to an array. Then, after completing the loop, I would like to show a
form with a list box containing the array just created.

Thank you.

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
Validation list via dynamic array in VBA Brady Excel Discussion (Misc queries) 1 February 8th 07 03:15 PM
Dynamic 2-Dim Array kAVAL Excel Programming 1 July 1st 04 01:07 AM
Dynamic Array Michael168[_82_] Excel Programming 1 June 2nd 04 07:26 AM
Dynamic 2D Array ExcelMonkey[_52_] Excel Programming 4 January 31st 04 09:32 PM
Dynamic Array dan Excel Programming 4 January 27th 04 04:16 PM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"