如果列B包含某個文本(「ACK-」,但我現在需要將整行直接複製到具有某些文本的行上方(「ACK-」這甚至可能任何幫助將不勝感激在包含某些文本的行上方複製行
Sub HEA_Filter()
Dim strArray As Variant
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim NoRows As Long
Dim DestNoRows As Long
Dim I As Long
Dim J As Integer
Dim rngCells As Range
Dim rngFind As Range
Dim Found As Boolean
strArray = Array("ack-")
Set wsSource = ActiveSheet
NoRows = wsSource.Range("A65536").End(xlUp).Row
DestNoRows = 1
Set wsDest = Sheets("Real Alarms")
For I = 1 To NoRows
Set rngCells = wsSource.Range("B" & I)
Found = False
For J = 0 To UBound(strArray)
Found = Found Or Not (rngCells.Find(strArray(J)) Is Nothing)
Next J
If Found Then
rngCells.EntireRow.Copy wsDest.Range("A" & DestNoRows)
DestNoRows = DestNoRows + 1
End If
Next I
End Sub
這很好用!謝謝!現在我有另一個問題了......當試圖將「A」欄的粘貼欄更改爲「F」時,它給了我一個錯誤,指出該單元格的大小不一樣......我如何解決這個問題? –