当前位置:网站首页>人力资源导出数据 excel VBA
人力资源导出数据 excel VBA
2022-06-26 14:46:00 【gavingxh】
切换HR系统,从sap导出来(用 RH_STRUC_GET)的 数据整理后是这样的
| 0 | 1 | O | 10000000 | 杰克 | 1 | #N/A | |
| 1 | 2 | O | 10000006 | 董事会 | 2 | 10000000 | 杰克 |
| 2 | 7 | O | 50007060 | 集团副总裁 | 3 | 10000006 | 董事会 |
| 7 | 45 | S | 50007057 | 集团副总裁 | 4 | 50007060 | 集团副总裁 |
| 45 | 234 | P | 18000 | 陈 | 5 | 50007057 | 集团副总裁 |
| 2 | 8 | S | 20000008 | 创始人 | 3 | 10000006 | 董事会 |
| 8 | 46 | P | 1 | 阮 | 4 | 20000008 | 创始人 |
| 2 | 9 | S | 20000009 | 副董事长 | 3 | 10000006 | 董事会 |
| 9 | 47 | P | 2 | 阮 | 4 | 20000009 | 副董事长 |
| 9 | 48 | P | 3 | 阮 | 4 | 20000009 | 副董事长 |
| 2 | 10 | S | 20000010 | 董事长 | 3 | 10000006 | 董事会 |
| 10 | 49 | P | 66 | 赵 | 4 | 20000010 | 董事长 |
| 2 | 11 | S | 20000011 | 独立董事 | 3 | 10000006 | 董事会 |
| 11 | 50 | P | 42 | 许 | 4 | 20000011 | 独立董事 |
| 11 | 51 | P | 40000784 | 陈 | 4 | 20000011 | 独立董事 |
| 11 | 52 | P | 40000785 | 王 | 4 | 20000011 | 独立董事 |
| 11 | 53 | P | 40000786 | 谢 | 4 | 20000011 | 独立董事 |
| 1 | 3 | O | 50006566 | 杰克股份 | 2 | 10000000 | 杰克 |
| 3 | 12 | O | 50006692 | 营销管理部 | 3 | 50006566 | 杰克股份 |
| 12 | 54 | O | 50019311 | 副总办 | 4 | 50006692 | 营销管理部 |
| 54 | 235 | S | 50006843 | 营销副总经理 | 5 | 50019311 | 副总办 |
| 235 | 789 | P | 15 | 阮 | 6 | 50006843 | 营销副总经理 |
| 235 | 790 | P | 1219 | 赖 | 6 | 50006843 | 营销副总经理 |
| 235 | 791 | P | 4331 | 秦 | 6 | 50006843 | 营销副总经理 |
| 12 | 55 | O | 50006851 | 秘书 | 4 | 50006692 | 营销管理部 |
| 55 | 236 | S | 50006850 | 秘书 | 5 | 50006851 | 秘书 |
| 236 | 792 | P | 10324 | 金 | 6 | 50006850 | 秘书 |
目标
想做成

导出来的组织通过有上下级关系,通过vlookup 引过来 名称 ,
为帮助人力完成结果 写了一小段VBA
Sub runva01()
Dim i, j, itemi, itemj, strp, modvalue, orgstr, ordidstr, pup, pseqindx
itemi = 2
itemj = 10998
For i = itemi To itemj
modvalue = Cells(i, 3)
orgstr = ""
ordidstr = ""
If modvalue = "S" Then
Cells(i, 12) = Cells(i, 4)
Cells(i, 11) = Cells(i, 5)
pup = Cells(i, 1)
For j = 2 To i
If Cells(j, 2) = pup Then
If Cells(j, 3) = "O" Then
pseqindx = j
End If
End If
Next
While pup <> 0
orgstr = Cells(pseqindx, 5) & "/" & orgstr
ordidstr = Cells(pseqindx, 4) & "/" & ordidstr
For j = 2 To i
If Cells(j, 2) = pup Then
If Cells(j, 3) = "O" Then
pseqindx = j
End If
End If
Next
pup = Cells(pseqindx, 1)
For j = 2 To i
If Cells(j, 2) = pup Then
If Cells(j, 3) = "O" Then
pseqindx = j
End If
End If
Next
Wend
Cells(i, 9) = orgstr
Cells(i, 10) = ordidstr
End If
Next
End Sub边栏推荐
猜你喜欢

年薪50万是一条线,年薪100万又是一条线…...
![[cloud native] codeless IVX editor programmable by](/img/10/7c56e46df69be6be522a477b00ec05.png)
[cloud native] codeless IVX editor programmable by "everyone"

Notes on writing questions in C language -- table tennis competition

在云服务器中云磁盘如何挂载

【 Native cloud】 Éditeur ivx Programmable par tout le monde

人的顶级能量从哪里获取?

TCP拥塞控制详解 | 1. 概述

Use abp Zero builds a third-party login module (II): server development

赠书 | 《认知控制》:我们的大脑如何完成任务?

印尼投资部长:鸿海考虑在其新首都建立电动公交系统、城市物联网
随机推荐
Deploy the flask environment using the pagoda panel
Electron
在云服务器中云磁盘如何挂载
Excerpt from three body
年薪50万是一条线,年薪100万又是一条线…...
Informatics Olympiad 1405: sum and product of prime numbers (thinking problem)
Oracle ASMM和AMM
同花顺注册开户安全吗,有没有什么风险?
【 Native cloud】 Éditeur ivx Programmable par tout le monde
15 bs对象.节点名称.节点名称.string 获取嵌套节点内容
信息学奥赛一本通 1405:质数的和与积 (思维题)
'教练,我想打篮球!' —— 给做系统的同学们准备的 AI 学习系列小册
备战数学建模31-数据插值与曲线拟合3
Go变量的声明与赋值
程序分析与优化 - 8 寄存器分配
Document 1
[cloud native] codeless IVX editor programmable by "everyone"
TCP 复位攻击原理
重磅白皮书发布,华为持续引领未来智慧园区建设新模式
nvidia-smi 报错