请VBA高手相助!一个范围内循环寻找多个对象的相同排列,如何实现求您...
发布网友
发布时间:2024-09-27 14:30
我来回答
共1个回答
热心网友
时间:2024-10-05 20:07
sub a()
dim dic as object
dim str as string
dim brr(1 to 1000)
set dic=createobject("scripting.dictionary")
arr=activesheet.range([a1],cells(5,1000))
for i=1 to ubound(arr,2)
str=""
for j=1 to 5
str=str & arr(i,j)
next
if dic.exists(str)=true then
if dic(str)!="" then
brr(dic(str))=1
dic(str)=""
end if
brr(i)=1
else
dic(str)=i
end if
next
'给第6行填充1
activesheet.range([a6],cells(6,1000))=application.transpose(brr)
'或者填充颜色
'for i=1 to 1000
' if brr(i)==1 then activesheet.cells(6,i).interior.color=vbred
'next
end sub