|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 人员信息导出()
- Dim sht, sht1 As Worksheet, i, n, m, x, y, z As Integer
- Set sht = ThisWorkbook.Worksheets(1)
- Set sht1 = ThisWorkbook.Worksheets(2)
- For i = 3 To sht1.Cells(Rows.Count, 11).End(xlUp).Row
- For n = 24 To sht.Cells(Rows.Count, 1).End(xlUp).Row
- If sht.Cells(n, 1).Value = sht1.Cells(i, 11).Value Then
- Select Case sht.Cells(n, 1).Value
- Case Is = "入职人员"
- m = m + 1
- sht.Cells(n + m, 2).Value = sht1.Cells(i, 4).Value
- sht.Cells(n + m, 3).Value = sht1.Cells(i, 5).Value
- sht.Cells(n + m, 4).Value = sht1.Cells(i, 3).Value
- sht.Cells(n + m, 5).Value = sht1.Cells(i, 10).Value
- sht.Cells(n + m, 6).Value = sht1.Cells(i, 9).Value
- Case Is = "离职人员"
- x = x + 1
- sht.Cells(n + x, 2).Value = sht1.Cells(i, 4).Value
- sht.Cells(n + x, 3).Value = sht1.Cells(i, 5).Value
- sht.Cells(n + x, 4).Value = sht1.Cells(i, 3).Value
- sht.Cells(n + x, 5).Value = sht1.Cells(i, 10).Value
- sht.Cells(n + x, 6).Value = sht1.Cells(i, 9).Value
- Case Is = "调入人员"
- y = y + 1
- sht.Cells(n + y, 2).Value = sht1.Cells(i, 4).Value
- sht.Cells(n + y, 3).Value = sht1.Cells(i, 5).Value
- sht.Cells(n + y, 4).Value = sht1.Cells(i, 3).Value
- sht.Cells(n + y, 5).Value = sht1.Cells(i, 10).Value
- sht.Cells(n + y, 6).Value = sht1.Cells(i, 9).Value
- Case Is = "调出人员"
- z = z + 1
- sht.Cells(n + z, 2).Value = sht1.Cells(i, 4).Value
- sht.Cells(n + z, 3).Value = sht1.Cells(i, 5).Value
- sht.Cells(n + z, 4).Value = sht1.Cells(i, 3).Value
- sht.Cells(n + z, 5).Value = sht1.Cells(i, 10).Value
- sht.Cells(n + z, 6).Value = sht1.Cells(i, 9).Value
- End Select
- End If
- Next
- Next
- End Sub
复制代码 |
|