|
- Sub qs()
- Application.ScreenUpdating = False: Application.DisplayAlerts = False
- Dim arr, i, dic, sht As Worksheet, wb As Workbook
- Set sht = Sheet1
- p = ThisWorkbook.Path & ""
- arr = Sheet2.Range("a1").CurrentRegion.Value
- brr = Sheet1.Range("a1").CurrentRegion.Value
- For i = 2 To UBound(arr)
- brr(1, 1) = arr(i, 1)
- For r = 2 To UBound(brr)
- For j = 2 To UBound(arr, 2)
- If brr(r, 1) = arr(1, j) Then
- brr(r, 2) = arr(i, j)
- Exit For
- End If
- Next j
- Next r
- Sheet1.Range("a1").Resize(UBound(brr), 2) = brr
- sht.Copy
- Set wb = ActiveWorkbook
- wb.SaveAs p & brr(1, 1) & ".xlsx"
- wb.Close
- Next i
- Set sht = Nothing: Set wb = Nothing
- Application.ScreenUpdating = True: Application.DisplayAlerts = True
- End Sub
复制代码 |
|