Sub 水果種類_不重複_1()
Dim xD, Brr, i&, xR As Range
Set xD = CreateObject("Scripting.Dictionary")
Set xR = Range([G1], Cells(Rows.Count, "G").End(xlUp))
Brr = xR
For i = 2 To UBound(Brr)
xD(Brr(i, 1)) = "Good"
Next
Workbooks.Add
[A1].Resize(1, xD.Count) = xD.keys
Set xD = Nothing: Set xR = Nothing: Erase Brr
End Sub作者: Andy2483 時間: 2023-4-20 13:32
Q:
程式架構時,是不是一開始就將變數制定好?
A:
依自己的經驗先擬個草稿,再程式設計時做宣告增減
最後將不需要用到的變數刪除即可
例如
Option Explicit
Sub TEST()
Dim Brr, Crr, V, Y, Z, Q, R&, C&, i&, j&, X&, T$, P$, b#, K%
Dim xR As Range, Ra As Range, Sh As Worksheet
Set Y = CreateObject("Scripting.Dictionary")
Set Y = Nothing: Set xR = Nothing: Erase Brr, Crr
End Sub作者: mdr0465 時間: 2023-4-21 12:33
Andy 學兄,你這些詳細,簡潔,易明的教學,真的令後學獲益良多....
多謝你無私的分享作者: Andy2483 時間: 2023-4-28 08:30