Chinaunix首页 | 论坛 | 博客
  • 博客访问: 786714
  • 博文数量: 156
  • 博客积分: 5320
  • 博客等级: 大校
  • 技术积分: 1605
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-09 12:24
文章分类

全部博文(156)

文章存档

2010年(20)

2009年(46)

2008年(21)

2007年(21)

2006年(33)

2005年(10)

2004年(5)

分类: 项目管理

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

阅读(1510) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~