|
楼主 |
发表于 2022-11-20 07:17
|
显示全部楼层
- Sub Clear1()
- Dim i&, j&, k&, arr() As String, brr
- arr = Split(Replace(TextBox1.Text, Chr(13), ""), Chr(10))
- brr = Sheets("Scrap data").UsedRange
- Sheets("Scrap data").UsedRange.Clear
- Sheets("Scrap data").Range("a1").Resize(1, UBound(brr, 2)) = Application.WorksheetFunction.Index(brr, 1) '先写标题
- k = 2
- For i = 2 To UBound(brr, 1)
- For j = LBound(arr) To UBound(arr)
- If brr(i, 6) = arr(j) Then
- Sheets("Scrap data").Range("a" & k).Resize(1, UBound(brr, 2)) = Application.WorksheetFunction.Index(brr, i)
- k = k + 1
- End If
- Next j
- Next i
- End Sub
复制代码
Sheets("Scrap data").Range("a" & k).Resize(1, UBound(brr, 2)) = Application.WorksheetFunction.Index(brr, i)
最后一句希望能将附合要求的项整体放进数组,最后再输出到表格,就会快;我不确定怎么写 |
|