近日一个培训机构朋友找到宁子想要帮他做一个人员信息查询管理的小程序,宁子看对于培训机构临时使用的程序,要求不算高,就用Excel VBA帮他做了一个,需要的朋友可以参考一下,如下图
源代码:
Private Sub cmdadd_Click()
If MsgBox("确定在职工档案中添加该员工的记录吗?", vbQuestion vbYesNo, "询问") = vbYes Then
nrow = Worksheets("职工档案").Range("A1").Range("A1").CurrentRegion.Rows.Count 1
Call edit
End If
End Sub
Private Sub cmddel_Click()
If MsgBox("确定将该员工信息移动到删除工作表中吗? ", vbQuestion vbYesNo, "询问") = vbYes Then
nrow = Worksheets("职工档案").Range("A1:A65536").find(Range("C7").Value, lookat:=xlWhole).Row
Worksheets("职工档案").Rows(nrow).Copy Worksheets("删除").Range("A65536").End(xlUp).Offset(1, 0)
Worksheets("职工档案").Cells(nrow, "A").EntireRow.Delete
End If
End Sub
Private Sub cmdedit_Click()
If MsgBox("确定修改职工档案中该员工的信息吗? ", vbQuestion vbYesNo, "询问") = vbYes Then
nrow = Worksheets("职工档案").Range("A1:A65536").find(Range("C7").Value, lookat:=xlWhole).Row
Call edit
End If
End Sub
Private Sub cmdend_Click()
nrow = Worksheets("职工档案").Range("A1").CurrentRegion.Rows.Count
Call findi
End Sub
Private Sub cmdfirst_Click()
nrow = 2
Call findi
End Sub
Private Sub cmdformer_Click()
If nrow = 2 Then
MsgBox ("不能再往前了")
Else
nrow = Worksheets("职工档案").Range("A2:A65536").find(Range("C7").Value, lookat:=xlWhole).Row - 1
Call findi
End If
End Sub
Private Sub cmdnext_Click()
nrow = Worksheets("职工档案").Range("A1:A65536").find(Range("C7").Value, lookat:=xlWhole).Row 1
Call findi
End Sub