分类: 项目管理
2007-01-17 12:22:59
''delete cell
Sub delete()
''ActiveWorkbook.Sheets(1).Rows("3").delete
On Error GoTo DelError
Do
Cells.Find(What:=0, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.ClearContents
Loop
DelError:
MsgBox "Delete complete!"
End Sub
------------------
''delete row
On Error GoTo DelError
Do
Cells.Find(what:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
''Selection.ClearContents
Rows(Selection.Row).Select
Selection.delete Shift:=xlUp
Loop
DelError:
MsgBox "Delete complete!"
--------------
''delete if H* = 0
Dim I%, Arr(1 To 256), K%, J%, L%
For I = 1 To 256
Arr(I) = Cells(65536, I).End(xlUp).Row
Next
K = Application.WorksheetFunction.Max(Arr)
For J = K To 1 Step -1
For L = 1 To 256
If InStr(Cells(J, L), "0") > 0 Then
Rows(J).Delete
Exit For
End If
Next
Next