|
Sub 求多表不重复值1()
Set d = CreateObject("scripting.dictionary")
On Error Resume Next
For Each sht In Sheets
s = sht.Name
If sht.Name <> "品名" Then
r = sht.Cells(Rows.Count, "a").End(xlUp).Row
arr = sht.Range("a1:a" & r)
For i = 1 To UBound(arr)
d.Add arr(i, 1), ""
Next i
End If
Next sht
Sheets("品名").[a1].Resize(d.Count) = WorksheetFunction.Transpose(d.keys)
End Sub
Sub 求多表不重复值2()
Set d = CreateObject("scripting.dictionary")
On Error Resume Next
For Each sht In Sheets
s = sht.Name
If sht.Name <> "品名" Then
lastcell = sht.Cells(Rows.Count, "a").End(xlUp)
arr = sht.Range([a1], lastcell)
For i = 1 To UBound(arr)
d.Add arr(i, 1), ""
Next i
End If
Next sht
Sheets("品名").[a1].Resize(d.Count) = WorksheetFunction.Transpose(d.keys)
End Sub
请问大侠:下面的表达方式不是一样吗?
1、 r = sht.Cells(Rows.Count, "a").End(xlUp).Row
arr = sht.Range("a1:a" & r)
2、lastcell = sht.Cells(Rows.Count, "a").End(xlUp)
arr = sht.Range([a1], lastcell)
|
|