|
Sub limonet()
Dim Brr As Variant, i%, k%, h$, Trr As Variant
i = Range("A" & Rows.Count).End(xlUp).Row
Brr = Application.Transpose(Range("B2:B" & i))
For k = 1 To UBound(Brr)
Name$ = Split(Brr(k), "评语")(0)
Trr = Filter(Application.Transpose(Range("A2:A" & i)), Name, True)
h = h & "';'" & Brr(k) & "'='" & Split(Trr(LBound(Trr)), Name)(0) & "-" & Trr(UBound(Trr))
Next k
CreateObject("wscript.shell").Run "powershell push-location " & ThisWorkbook.Path _
& ";$h=[ordered]@{" & Mid(h, 3) & "'};md ($h.values | select -unique);ForEach ($i in $h.Keys)" _
& "{Set-Content ($h[$i]+'\'+(++$j,$i,'.txt' -join '')) -Value $i}", 0
End Sub |
|