返回列表 上一主題 發帖

不同工作表內的資料比對與填入.

回復 3# MRSA
  1. Sub Ex()
  2.     Dim E As Range, I
  3.     For Each E In Sheet1.Range("A:A").SpecialCells(xlCellTypeConstants)
  4.         I = Application.Match(E, Sheet2.Range("A:A"), 0)
  5.         If IsNumeric(I) Then E.End(xlToRight).Offset(, 1) = Sheet2.Cells(I, "B")
  6.     Next
  7. End Sub
複製代碼

TOP

With Sheets(2)中的End With為何放到最底下呢?
可以放在With Sheets(1)之前嗎?asus103 發表於 2011-1-10 08:15

可以的
With Sheets(2)中的End With寫在With Sheets(1)之前 並不影響整個程式結構

TOP

        靜思自在 : 能付出愛心就是福,能消除煩惱就是慧。
返回列表 上一主題