Private Sub 新增_Click() Dim j As Integer ax = 2 If Application.WorksheetFunction.CountA(Sheets("查询").Range("b6:U6")) = 0 Then MsgBox "没有一个号码?", vbOKOnly End If If Trim(Sheets("查询").Cells(6, 2).Value) = "" Then MsgBox "请输入 姓名!", vbOKOnly End If End Sub Do While Not (IsEmpty(Sheets("数据库").Cells(ax, 2).Value)) ax = ax + 1 Loop Cells(6, 1) = Cells(1, 1) Cells(1, 1) = Cells(6, 1) + 1 For j = 1 To 18 Sheets("数据库").Cells(ax, j) = Sheets("查询").Cells(6, j) Next j Sheets("查询").Select Rows("6:6").Select Selection.Delete Shift:=xlUp Range("C4").Select End Sub
加入后出错 单个都可以运行的 |