|
- Sub test()
- Dim arrInfo()
- arrInfo = Sheets("明细").[a1].CurrentRegion.Value
- Dim peopleNum$
- peopleNum = 0
- For i = 1 To UBound(arrInfo, 1)
- If arrInfo(i, 1) <> "" Then peopleNum = peopleNum + 1
- Next
- peopleNum = peopleNum - 1
-
- '删除多余的sheet表
- Application.DisplayAlerts = False
- For i = Sheets.Count To 4 Step -1
- Sheets(i).Delete
- Next
- Application.DisplayAlerts = True
-
- '创建新sheet表
- Sheets("模板").Copy after:=Sheets(Sheets.Count)
- Sheets(Sheets.Count).Name = "结果"
- Sheets("结果").Activate
-
- '根据人数创建表格
- For i = 1 To peopleNum
- If i > 1 Then
- Sheets("结果").Range("A1:L12").Copy Sheets("结果").Range("A" & (i - 1) * 13 + 1)
- End If
- Next
-
- '填充数据
- j = 2 '明细数据起始行
- For i = 1 To peopleNum
- k = (i - 1) * 13 + 1 '填充表起始行
- Sheets("结果").Cells(k, 1).Value = "失业人员就业帮扶记录(" & "i" & ")号"
- Sheets("结果").Cells(k + 1, 2).Value = arrInfo(j, 1) '姓名
- Sheets("结果").Cells(k + 1, 4).Value = arrInfo(j, 2) '性别
- Sheets("结果").Cells(k + 1, 6).Value = arrInfo(j, 3) '年龄
- Sheets("结果").Cells(k + 1, 8).Value = arrInfo(j, 4) '学历
- Sheets("结果").Cells(k + 1, 10).Value = arrInfo(j, 5) '是否城乡困难人员
- Sheets("结果").Cells(k + 1, 12).Value = arrInfo(j, 6) '困难类型
- Sheets("结果").Cells(k + 2, 2).Value = arrInfo(j, 7) '住址
- Sheets("结果").Cells(k + 2, 5).Value = arrInfo(j, 8) '联系方式
- Sheets("结果").Cells(k + 2, 8).Value = arrInfo(j, 9) '特长
- Sheets("结果").Cells(k + 2, 10).Value = arrInfo(j, 10) '是否登记
- Sheets("结果").Cells(k + 2, 12).Value = arrInfo(j, 11) '当前状态
- Sheets("结果").Cells(k + 3, 3).Value = arrInfo(j, 12) '是否需要帮扶
- Sheets("结果").Cells(k + 3, 5).Value = arrInfo(j, 13) '帮扶内容
- Sheets("结果").Cells(k + 3, 9).Value = arrInfo(j, 14) '帮扶意向
- Sheets("结果").Cells(k + 3, 11).Value = arrInfo(j, 15) '备注
-
- Do
- Sheets("结果").Cells(k + 7, 1).Value = arrInfo(j, 16) '帮扶次数
- Sheets("结果").Cells(k + 7, 2).Value = arrInfo(j, 17) '帮扶时间
- Sheets("结果").Cells(k + 7, 3).Value = arrInfo(j, 18) '帮扶内容
- Sheets("结果").Cells(k + 7, 7).Value = arrInfo(j, 19) '帮扶签字
- Sheets("结果").Cells(k + 7, 9).Value = arrInfo(j, 20) '对本次帮扶
- Sheets("结果").Cells(k + 7, 10).Value = arrInfo(j, 21) '需要的帮扶
- Sheets("结果").Cells(k + 7, 12).Value = arrInfo(j, 22) '是否就业
- k = k + 1 '就业帮扶记录下移一行
- j = j + 1 '帮扶次数下移一条记录
- If j > UBound(arrInfo, 1) Then Exit Sub '结束
- Loop Until arrInfo(j, 1) <> "" Or i > peopleNum
- Next
- End Sub
复制代码 |
|