Listbox

NIPUL JARIWALA

Board Regular
Joined
Apr 22, 2016
Messages
55
I want if sheet8.cells(Y,20) is in listbox7's column20
Then it should not be added in listbox7
Please help me.

Code:
Dim X, Y As Integer
For X = 0 To ListBox8.ListCount - 1
    If ListBox8.Selected(X) Then
            For Y = 3 To Sheet8.Range("a1048576").End(xlUp).Row
            If Sheet8.Cells(Y, 1) = ListBox8.List(X, 0) Then
                AI = ListBox7.ListCount
                ListBox7.AddItem
                ListBox7.List(AI, 0) = Sheet8.Cells(Y, 1)
            End If
            Next Y
    End If
Next X
 
Last edited by a moderator:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I want if sheet8.cells(Y,20) is in listbox7's column20
According to your code, in listbox7 you are only adding one column. But your question you want to compare column 20.
You could explain with examples what you want to do.

Another thing, you want to pass data from listbox8 to listbox7, in listbox8 can you select several items or only one?
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,841
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top