返回列表 上一主題 發帖

[發問] 相同資料欄位刪除/指定資料列重新排列

回復 3# marklos
  1. Sub ex()
  2. Dim ar()
  3. Set d = CreateObject("Scripting.Dictionary")
  4. With Sheets("Sheet1")
  5. For Each a In .Range(.[A1], .[A1].End(xlDown))
  6. x = Join(Application.Transpose(Application.Transpose(a.Resize(, 10).Value)), Chr(9))
  7. If IsEmpty(d(x)) Then
  8.   d(x) = x
  9. y = Split(x, Chr(9))
  10. If a.Offset(, 3) <> "" Then
  11. For i = 1 To 2
  12. If i = 2 Then y(0) = ""
  13.   ReDim Preserve ar(s)
  14.   ar(s) = y
  15.   s = s + 1
  16. Next
  17. Else
  18. ReDim Preserve ar(s): ar(s) = y: s = s + 1
  19. End If
  20. End If
  21. Next
  22. End With
  23. With Sheets("Sheet3")
  24. Application.DisplayAlerts = False
  25. .[A1].Resize(s, 10) = Application.Transpose(Application.Transpose(ar))
  26. Application.DisplayAlerts = True
  27. End With
  28. End Su
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 人的眼睛長在前面,只看到別人的缺點,絲毫看不到自己的缺點。
返回列表 上一主題