» 您尚未登录:请 登录 | 注册 | 标签 | 帮助 | 小黑屋 |


发新话题
打印

[电脑] EXCEL数据比对的问题

写一段丑陋的VBA, 抛砖引玉

i_1 = sheet(1).range("A1").End(xlDown).Row
i_2 = sheet(2).range("A1").End(xlDown).Row

Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
for i = 1 to i_1
  dic(sheet(1).cells(i, 1).value) = 1
next i
j = 1
for i = 1 to i_2
  if dic.exists(sheet(2).cells(i,1).value) then
    sheet(3).cells(j, 1).value = sheet(2).cells(i,1).value
    j = j + 1
  end if
next i


TOP

发新话题
     
官方公众号及微博