麻烦老师解释一下这条语句好吗?谢谢c.Add arr2(i, 2), "x" & arr2(i, 1) 顺便问一下,既然定义了数组arr1,arr2,为什么不这样表示arr1(),arr2(),这种方法哪种表示好一点 Sub Macro1() Dim arr1, arr2, c As New Collection, i As Long arr1 = Sheets("Sheet1").UsedRange arr2 = Sheets("Sheet2").UsedRange For i = 1 To UBound(arr2, 1) c.Add arr2(i, 2), "x" & arr2(i, 1) Next On Error Resume Next For i = 1 To UBound(arr1, 1) If Not IsNull(c("x" & arr1(i, 1))) Then arr1(i, 1) = c("x" & arr1(i, 1)) 'If IsNumeric(arr1(i, 1)) Then arr1(i, 1) = "" Next Sheets("Sheet3").Select Range("a1").Resize(UBound(arr1, 1), UBound(arr1, 2)) = arr1 MsgBox "ok" End Sub |