kyh 發問時間： 電腦與網際網路程式設計 · 1 0 年前

# excel如何將重覆數值的列刪除

Sheet1

........A.........B.........C

1.......5........-1.1.........50

2......20.......-2.2....... 30

3.......5.........-1.1....... 55

4......18..........0........ 21

5.......2........1.3.........17

6......15........1.8.........7

7......2........1.3.........17

8......17........2.5.........5

Sheet2

........A.........B.........C

1......20.......-2.2....... 30

2.......5.........-1.1....... 55

3......18..........0........ 21

4......2........1.3.........17

5......15........1.8.........7

6......17........2.5.........5

2 個已更新項目:

applerot 大師您好:

3 個已更新項目:

applerot 大師

Sheet1

......A.......B.......C

8.....

9......15........1.8.......7

10.....15.......1.8.......6

11......2........1.3.......18

Sheet2

........A.......B.......C

6.....

7......15.....1.8.......6

8......2......1.3.......18

4 個已更新項目:

applerot 大師

### 3 個解答

• 顯栓
Lv 7
1 0 年前
最佳解答

沒2007版

2003版

http://tco.cseintltd.com.tw/applerot/VBA/Derept.xl...

測試看看!

2010-08-07 14:01:32 補充：

4......2........1.3.........17...............刪

9......15........1.8.......7.......7>6.....留

10.....15.......1.8.......6..................刪

11......2........1.3.......18.....18>17..留

目前程式狀況是如此!

如有其他再說明!

2010-08-07 19:16:10 補充：

Sub Macro1()

Dim arr(), brr()

a = [A65536].End(xlUp).Row

ReDim Preserve arr(a - 1)

For i = 1 To a

arr(i - 1) = Range("A" & i) & Range("B" & i)

Next

b = Application.Match(arr, arr, 0) For i = 1 To a

If i = b(i) Then

k = k + 1

ReDim Preserve brr(k - 1)

brr(k - 1) = i

For j = i + 1 To [A65536].End(xlUp).Row

If Range("A" & i) = Range("A" & j) Then

If Range("B" & i) = Range("B" & j) Then

If Range("C" & i) < Range("C" & j) Then

brr(k - 1) = j

End If

End If

End If

Next

End If

NextFor l = 1 To k

Sheets(2).Range("A" & l) = Sheets(1).Range("A" & brr(l - 1))

Sheets(2).Range("B" & l) = Sheets(1).Range("B" & brr(l - 1))

Sheets(2).Range("C" & l) = Sheets(1).Range("C" & brr(l - 1))

Next

• 匿名使用者
6 年前

到下面的網址看看吧

• loow77
Lv 5
1 0 年前

同時刪除對程式執行會有影响

不知您最終的結果要整合嗎?

或者一定要放在不同SHEET裡?