当前位置:网站首页>HR export data Excel VBA

HR export data Excel VBA

2022-06-26 15:06:00 gavingxh

Switch HR System , from sap Guide out ( use RH_STRUC_GET) Of After the data is sorted out  

01O10000000 jack 1#N/A
12O10000006 Board of directors 210000000 jack
27O50007060 Group vice president 310000006 Board of directors
745S50007057 Group vice president 450007060 Group vice president
45234P18000 Chen 550007057 Group vice president
28S20000008 founder 310000006 Board of directors
846P1 Ruan 420000008 founder
29S20000009 Vice Chairman 310000006 Board of directors
947P2 Ruan 420000009 Vice Chairman
948P3 Ruan 420000009 Vice Chairman
210S20000010 Chairman of the board of directors 310000006 Board of directors
1049P66 Zhao 420000010 Chairman of the board of directors
211S20000011 independent director 310000006 Board of directors
1150P42 xu 420000011 independent director
1151P40000784 Chen 420000011 independent director
1152P40000785 king 420000011 independent director
1153P40000786 thank 420000011 independent director
13O50006566 Jack shares 210000000 jack
312O50006692 Marketing management department 350006566 Jack shares
1254O50019311 Deputy General Office 450006692 Marketing management department
54235S50006843 Deputy general manager of marketing 550019311 Deputy General Office
235789P15 Ruan 650006843 Deputy general manager of marketing
235790P1219 lai 650006843 Deputy general manager of marketing
235791P4331 The qin dynasty 650006843 Deputy general manager of marketing
1255O50006851 secretary 450006692 Marketing management department
55236S50006850 secretary 550006851 secretary
236792P10324 gold 650006850 secretary

The goal is  

I want to make it

 

The exported organization has a parent-child relationship , adopt vlookup Bring it here name ,

To help people achieve results Wrote a short paragraph 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

原网站

版权声明
本文为[gavingxh]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261445421103.html