返回列表 上一主題 發帖

[發問] 更新資料但列位不同

這不是IN表直接複製到本表就好了嗎
學海無涯_不恥下問

TOP

回復 4# GBKEE
  1. Sub Ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. With Sheet1
  4.   For Each a In .Range(.[B1], .[B1].End(xlToRight))
  5.      For Each b In .Range(.[A2], .[A2].End(xlDown))
  6.         d(a & b) = .Cells(b.Row, a.Column).Value
  7.      Next
  8.   Next
  9. End With
  10. With Sheet2
  11.   For Each a In .Range(.[B1], .[B1].End(xlToRight))
  12.      For Each b In .Range(.[A2], .[A2].End(xlDown))
  13.        If .Cells(b.Row, a.Column) = "" Then .Cells(b.Row, a.Column).Value = d(a & b)
  14.      Next
  15.   Next
  16. End With
  17. End Sub
複製代碼
學海無涯_不恥下問

TOP

        靜思自在 : 是非當教育,讚美作警惕。
返回列表 上一主題