|
- Sub 转父子结构()
- Dim vData As Variant, iData As Integer
- Dim sName(1 To 3) As String, iName As Integer
- Dim iNum(1 To 3) As Double
-
- Application.ScreenUpdating = False
- vData = [J1:L1].Value
- [J:L].ClearContents
- [J1:L1] = vData
- vData = [A1].CurrentRegion.Value
- For iData = 1 To UBound(vData)
- For iName = 1 To 2
- If vData(iData, iName) <> "" Then Exit For
- Next
- sName(iName) = vData(iData, iName + 1)
- iNum(iName) = vData(iData, 5)
- If iName > 1 Then
- With [J65536].End(xlUp)
- .Offset(1, 0) = sName(iName - 1)
- .Offset(1, 1) = sName(iName)
- .Offset(1, 2) = iNum(iName) / iNum(iName - 1)
- End With
- End If
- Next
- [J:L].Sort Key1:=[J2], Order1:=xlAscending, Key2:=[K2], Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
- Orientation:=xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:=xlSortNormal
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|