Excel 選不重覆記錄,也可以這樣玩
UBTmp = UBound(arr_Tmp, 1)
LBTmp = LBound(arr_Tmp, 1)
For j = LBTmp To UBTmp - 1
k1 = Application.Large(arr_Tmp, j)
k2 = Application.Large(arr_Tmp, j + 1)
If k1 <> k2 Then
str_k = str_k & k2 & "," '值寫成字串
End If
Next j
'再將字串轉換成陣列,成為不重覆資料
str_k = Application.Large(arr_Tmp, 1) & "," & str_k
len_Str = Len(str_k)
ReStr = Left(str_k, len_Str - 1)
arrStr = Split(ReStr, ",")
LBTmp = LBound(arr_Tmp, 1)
For j = LBTmp To UBTmp - 1
k1 = Application.Large(arr_Tmp, j)
k2 = Application.Large(arr_Tmp, j + 1)
If k1 <> k2 Then
str_k = str_k & k2 & "," '值寫成字串
End If
Next j
'再將字串轉換成陣列,成為不重覆資料
str_k = Application.Large(arr_Tmp, 1) & "," & str_k
len_Str = Len(str_k)
ReStr = Left(str_k, len_Str - 1)
arrStr = Split(ReStr, ",")
留言
張貼留言