Sub test()
Dim x, y
Set x = ActiveSheet.UsedRange.Find("品名", lookat:=xlWhole)
Set y = ActiveSheet.UsedRange.Find("合计", lookat:=xlWhole)
If Not x Is Nothing And Not y Is Nothing Then
x = x.Row + 1
y = y.Row - 1
If y > x Then
Rows(x & ":" & y).Delete '删除行
' Rows(x & ":" & y).ClearContents '清除指定区域的内容
End If
End If
End Sub
Sub test()
Dim x, y
Set x = ActiveSheet.UsedRange.Find("品名", lookat:=xlWhole)
Set y = ActiveSheet.UsedRange.Find("合计", lookat:=xlWhole)
If Not x Is Nothing And Not y Is Nothing Then
x = x.Row + 1
y = y.Row - 1
If y > x Then
Rows(x & ":" & y).Delete '删除行
' Rows(x & ":" & y).ClearContents '清除指定区域的内容
End If
End If
End Sub