Excel – VBA – 在单元格内search特定的值

是否有可能在列中search特定值?

我希望能够search列“B”中的所有单元格,并在其中查找“单词”“不可能”(不区分大小写)。 我有其他的一切,只需要知道这是可能的,或者如何做。

我目前的代码如下所示:

Sub PriorityAIMS() ActiveSheet.Name = "Raw Data" Dim ws As Worksheet Set ws = Sheets("Raw Data") Dim ws1 As Worksheet Set ws1 = ThisWorkbook.Sheets.Add(After:= _ ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ws1.Name = "FEAS" ws.Activate Row = 2 Dim i As Integer For i = 1 To 1500 If (Cells(i, 2).Value = (HAS FEAS IN IT) Then 'This is the part that i'm struggling with Copied = ws.Range(Cells(i, 1), Cells(i, 17)).Value 'If possible, this would cut and paste so it deleted the original ws1.Activate ws1.Range(Cells(Row, 1), Cells(Row, 17)).Value = Copied Row = Row + 1 ws.Activate End If Next i End Sub 

编辑:只是为了澄清,在B列的价值将永远不会是“不可能”。 这将是一个完整的句子,但如果它包含“不足”,那么我想IFfunction工作。

FindFindNext很好(很快!)

  '... Dim copyRange As Range Dim firstAddress As String Set copyRange = ws.Range("B1:B1500").Find("feas", , , xlPart) If Not copyRange Is Nothing Then firstAddress = copyRange.Address Do ws2.Range(Cells(Row, 1), Cells(Row, 17)).Value = Intersect(copyRange.EntireRow, ws.Columns("A:Q")).Value Row = Row + 1 Set copyRange = Range("B1:B1500").FindNext(copyRange) Loop While copyRange.Address <> firstAddress End If '...