應該使用什麼宏來查找以D開頭的所有行並刪除這些行。 現在我正在使用:(刪除TOTAL以上的每個文本),這並不總是完美的工作。如何查找以特定字母開頭並刪除該行的單詞?
Sub A2a_Deleterowsabove()
Dim foundOne As Range
On Error Resume Next
With ActiveSheet
Set foundOne = .Range("A:A").Find(what:="TOTAL", After:=.Range("a1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If foundOne.Row > 1 Then
Range(.Range("e1"), foundOne.Offset(-1, 0)).EntireRow.delete shift:=xlUp
Else
End If
End With
End Sub
我想用這個的:
Sub Delete_Cells_with_D()
Dim i As Integer
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1) = "D* -" Then Cells(i, 1).EntireRow.Delete shift:=xlUp
Next i
End Sub
我應該把什麼在宏#2的突出部分,以表明該d後面的數字是未知的?
感謝您的幫助!
'If Cells(i,1)like「D *」Then ...' –