LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Additem problem

Good day Group,

Have following problem. By the code below I try to add all items of range
A1:A10 to
a Listbox. It works OK but the first added item will be the one of cell "A2"
not of cell "A1"
which appears in the bottom of theListbox.

Grateful for some hints.

CG Rosen
----------------------------------------------------------------------
With Sheets("Sheet1").Range("A1:A10")

Set j = .Find("*", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows)

If Not j Is Nothing Then
firstAddress = j.Address
Do
r = j.Row

Item1 = Sheets("Sheet1").Cells(r, 1)
Item2 = Sheets("Sheet1").Cells(r, 2)

UserForm1.ListBox1.AddItem Item1
UserForm1.ListBox1.List(ListBox1.ListCount - 1, 1) = Item2

Set j = .FindNext(j)
Loop While Not j Is Nothing And j.Address < firstAddress

End If

End With



 
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
Listbox AddItem problem [email protected] Excel Programming 0 July 18th 07 08:34 PM
.additem ernie Excel Programming 1 September 5th 06 05:31 PM
dropdownmenu with additem Peter[_55_] Excel Programming 1 September 25th 05 01:28 AM
Please help with AddItem method Shilps Excel Programming 2 April 19th 04 01:24 PM
.additem Robert Couchman[_4_] Excel Programming 3 February 20th 04 02:47 PM


All times are GMT +1. The time now is 04:12 AM.

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"