View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NNexcel NNexcel is offline
external usenet poster
 
Posts: 3
Default Compare Cells on Sheet to ListBox Selection

Hello.

Listbox2 contains selections from Listbox1. I want to be able to see if
the value of a cell on a sheet is contained within the values of Listbox2. I
can not figure out a code that will allow me to say something similar to "If
Range(ColumnD & r).Value NOT IN myList2Company Then..."

Thank you for your help in advance.

Here's my code:

Set LBox2 = ListBox2

myList2Company = LBox2.List

Dim DelCompRow(65000) As String

For r =2 to LastRow
'This is where my problem is: If Range(ColumnD & r).Value NOT IN
myList2Company Then
DeleteThisRow(r)="YES"
End If
Next r