多重不重覆資料抓取方式請問
Dear ALL 大大1.SHEET1 資料如下
A欄 B C D E
1列 名稱 版別 單位 註1 註2
2 麻 A KG 11 22
3 麻 B KG 33 44
4 黑 A MM 55 66
5 麻 B KG 77 88
.........
1.1 需求為 A.B.C 欄之 內容相同者算重覆.只取優先列之資料一筆
以上資料為例 麻BKG 重覆 只取第一筆 麻BKG 整列資料至SHEET2 如下
A欄 B C D E
1列 名稱 版別 單位 註1 註2
2 麻 A KG 11 22
3 麻 B KG 33 44
4 黑 A MM 55 66
煩不吝賜教 THANKS*10000 是要這樣嗎?
[attach]28035[/attach] [i=s] 本帖最後由 Hsieh 於 2017-11-29 15:29 編輯 [/i]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=101449&ptid=20338]1#[/url] [i]rouber590324[/i] [/b]
[attach]28037[/attach]
若是版本較低沒有移除重複功能,試試[code]Sub ex()
Set d = CreateObject("Scripting.Dictionary")
For Each a In Range([A1], [A1].End(xlDown))
d(a & a.Offset(, 1) & a.Offset(, 2)) = a.Resize(, 5).Value
Next
[I1].Resize(d.Count, 5) = Application.Transpose(Application.Transpose(d.items))
End Sub
[/code] dear kim223824 與 Hsieh 大大
感謝指導. ok啦 thanks*10000 我想請教各大大...如果我想要的不是像版大取第一筆,而是要最後一筆....前者重覆的要刪除,那麼該如何改呢? [b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118659&ptid=20338]5#[/url] [i]phoebegin[/i] [/b]
請測試看看,謝謝
Sub test()
Set d = CreateObject("Scripting.Dictionary")
For Each a In Range([A1], [A1].End(xlDown))
If Not d.Exists(a & a.Offset(, 1) & a.Offset(, 2)) Then
d(a & a.Offset(, 1) & a.Offset(, 2)) = a.Resize(, 5).Value
End If
Next
[I1].Resize(d.Count, 5) = Application.Transpose(Application.Transpose(d.items))
End Sub [url]https://blog.xuite.net/hcm19522/twblog/590346438[/url] 太好了....
感謝兩位高手大大........
頁:
[1]