Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Validation list via dynamic array in VBA | Excel Discussion (Misc queries) | |||
Dynamic 2-Dim Array | Excel Programming | |||
Dynamic Array | Excel Programming | |||
Dynamic 2D Array | Excel Programming | |||
Dynamic Array | Excel Programming |