Private Sub CommandButton2_Click() Dim Xulie As String Dim n As Long Dim Flag As Boolean '判断是否找到 Flag = False n = 2 With Sheets("数据库") Xulie = Cells(4, 3) Do While .Cells(n, 1) <> "" If .Cells(n, 1) = Xulie Then .Rows(n).Delete Shift:=xlUp Range("C4:C17").ClearContents Range("C4").Select Flag = True Exit Do End If n = n + 1 Loop End With If Flag = False Then MsgBox " 对不起 没有找到!" End Sub
[此贴子已经被作者于2010-2-9 14:57:31编辑过] |