Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Issues with InStr
I am trying to create a macro that looks at a string from one cell and
compares it to each cell in a list on another sheet. If the part of the string in the list cell contains the contents in the first cell, the entire contents of the list string is copied into a second area. The code I have is below... strKeyword = Sheet1.Cells(6, 2) For lngRow = 2 To Sheet2.Cells(65536, 1).End(xlUp).Row If InStr(strKeyword, Sheet2.Cells(lngRow, 1)) 0 Then Sheet1.Cells(Sheet1.Cells(65536, 2).End(xlUp).Row + 1, 2) = Sheet2.Cells(lngRow, 1) End If Next lngRow The problem I have is that the computer acts like each list item contains the contents of my search cell... What am I missing? |