Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default populate multicolumn listbox?

I got thics code here but I can't insert results in listbox.

With userform1
if .optionButton1 then
sOne = "Horse"
else
sOne = "Pig"
end if
if .optionButton3 then
sTwo = "Danish"
else
sTwo = "Foreign"
end if
sThree = .Textbox1.Text
End With
With Worksheets(1).Cells
Set c = .Find(sOne, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
if application.countif(c.EntireRow,"*" & sTwo & "*") and _
application.Countif(c.EntireRow,"*" & sThree & "*") then
' add row to listbox
end if
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default populate multicolumn listbox?

You just said you wanted to add the row to the listbox. That is
significantly vague. Obviously you don't want to add 256 cells to the
listbox. so what do you want to do? What cells in the found code do you
want to add to the listbox.

--
Regards,
Tom Ogilvy


"Alen32" wrote in message
lkaboutsoftware.com...
I got thics code here but I can't insert results in listbox.

With userform1
if .optionButton1 then
sOne = "Horse"
else
sOne = "Pig"
end if
if .optionButton3 then
sTwo = "Danish"
else
sTwo = "Foreign"
end if
sThree = .Textbox1.Text
End With
With Worksheets(1).Cells
Set c = .Find(sOne, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
if application.countif(c.EntireRow,"*" & sTwo & "*") and _
application.Countif(c.EntireRow,"*" & sThree & "*") then
' add row to listbox
end if
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default populate multicolumn listbox?

like her:
.ListBox1.AddItem cell.Value
.ListBox1.List(.ListBox1.ListCount - 1, 1) _
= cell.Offset(0, 2).Value
.ListBox1.List(.ListBox1.ListCount - 1, 2) _
= cell.Offset(0, 5).Value


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default populate multicolumn listbox?

With userform1
if .optionButton1 then
sOne = "Horse"
else
sOne = "Pig"
end if
if .optionButton3 then
sTwo = "Danish"
else
sTwo = "Foreign"
end if
sThree = .Textbox1.Text
End With
With Worksheets(1).Cells
Set c = .Find(sOne, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
if application.countif(c.EntireRow,"*" & sTwo & "*") and _
application.Countif(c.EntireRow,"*" & sThree & "*") then
Userform1.ListBox1.AddItem c.Value
Userform1.ListBox1.List( _
Userform1.ListBox1.ListCount - 1, 1) _
= c.Offset(0, 2).Value
Userform1.ListBox1.List( _
Userform1.ListBox1.ListCount - 1, 2) _
= c.Offset(0, 5).Value
end if
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

Assuming the cell you want to base your offset on is the the one containing
pig or horse

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
You just said you wanted to add the row to the listbox. That is
significantly vague. Obviously you don't want to add 256 cells to the
listbox. so what do you want to do? What cells in the found code do you
want to add to the listbox.

--
Regards,
Tom Ogilvy


"Alen32" wrote in message
lkaboutsoftware.com...
I got thics code here but I can't insert results in listbox.

With userform1
if .optionButton1 then
sOne = "Horse"
else
sOne = "Pig"
end if
if .optionButton3 then
sTwo = "Danish"
else
sTwo = "Foreign"
end if
sThree = .Textbox1.Text
End With
With Worksheets(1).Cells
Set c = .Find(sOne, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
if application.countif(c.EntireRow,"*" & sTwo & "*") and _
application.Countif(c.EntireRow,"*" & sThree & "*") then
' add row to listbox
end if
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default populate multicolumn listbox?

fantastic its working!!!!
Thanks Tom!!

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
multicolumn listbox move or value set Andrew Smith Excel Programming 3 August 25th 04 05:18 AM
Reordering with Multicolumn Listbox asmenut Excel Programming 2 August 17th 04 01:53 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
multicolumn Listbox and textalignment John Holland Excel Programming 3 September 11th 03 01:45 AM
Values in a MultiColumn Listbox Tom Ogilvy Excel Programming 5 September 5th 03 08:30 PM


All times are GMT +1. The time now is 04:08 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"