VBA查找重復值壹般使用字典對象,例子代碼:
arr?=?range("a1:d10")?'需要檢查的區域
for?i=1?to?ubound(arr)
for?j=1?to?ubound(arr,2)
if?db.exists(arr(i,j))?then
msgbox?"發現重復值:"?&?arr(i,j)
else
db(arr(i,j))?=?true
end?if
next?j
next?i