麻辣家族討論版版's Archiver

duck_simon 發表於 2022-4-17 10:37

不重覆列出

請教先進 :
重覆數字  列出
詳如附件內文說明..感謝指導..
[attach]34771[/attach]

samwang 發表於 2022-4-17 15:09

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118642&ptid=23632]1#[/url] [i]duck_simon[/i] [/b]

請測試看看,謝謝
Sub test()
Dim Arr, xD, T$, i&, j%
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range("b2:m3")
For i = 1 To UBound(Arr): For j = 1 To UBound(Arr, 2)
    T = Arr(i, j): If T <> "" Then xD(T) = ""
Next: Next
Range("bb1").Resize(xD.Count, 1) = Application.Transpose(xD.keys)
With Range("bb1:bb" & xD.Count)
    .Sort Key1:=.Item(1), Order1:=1, Header:=2
End With
Arr = Range("bb1:bb" & xD.Count)
Range("bb1:bb" & xD.Count).Clear
Range("b6").Resize(1, UBound(Arr)) = Application.Transpose(Arr)
End Sub

duck_simon 發表於 2022-4-17 18:55

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118643&ptid=23632]2#[/url] [i]samwang[/i] [/b]

請問如何寫入?  小的笨拙..謝謝

samwang 發表於 2022-4-17 20:31

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118647&ptid=23632]3#[/url] [i]duck_simon[/i] [/b]

將程式碼貼到一般模組裡即可,謝謝

Quake 發表於 2022-4-17 21:09

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118642&ptid=23632]1#[/url] [i]duck_simon[/i] [/b]

Sub Ex()
    Dim d As Object
    Dim cell As Range
    Set d = CreateObject("Scripting.Dictionary")
    For Each cell In [B2:M3]
        d(cell.Value) = ""
    Next cell
    Rows("6").ClearContents
    [B6].Resize(1, d.Count) = d.keys
    [B6].Resize(1, d.Count).Sort Key1:=[B6], Orientation:=xlLeftToRight
End Sub

duck_simon 發表於 2022-4-17 21:46

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118650&ptid=23632]5#[/url] [i]Quake[/i] [/b]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118643&ptid=23632]2#[/url] [i]samwang[/i] [/b]
回2位前輩..請幫我加入壓縮檔理好嗎?  我代入模組還是有問題...謝謝

samwang 發表於 2022-4-18 07:19

[i=s] 本帖最後由 samwang 於 2022-4-18 07:20 編輯 [/i]

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118652&ptid=23632]6#[/url] [i]duck_simon[/i] [/b]

參考Quake的做法小修改一下如附件,謝謝

duck_simon 發表於 2022-4-18 19:34

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118656&ptid=23632]7#[/url] [i]samwang[/i] [/b]
[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118650&ptid=23632]5#[/url] [i]Quake[/i] [/b]
感謝二位大大的指導..成功可用..萬分感激..謝謝

hcm19522 發表於 2022-4-19 12:17

[url]https://blog.xuite.net/hcm19522/twblog/590346359[/url]

duck_simon 發表於 2022-4-26 11:37

[quote]
[size=2][color=#999999]hcm19522 發表於 2022-4-19 12:17[/color] [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118663&ptid=23632][img]http://forum.twbts.com/images/common/back.gif[/img][/url][/size][/quote]

感謝大大  仔細看了 很棒...:victory:

頁: [1]

麻辣家族討論版版為 麻辣學園 網站成員  由 昱得資訊工作室 © Since 1993 所提供