本帖最后由 冥王 于 2014-4-18 22:49 编辑
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim d As Object
- Dim myrow As Integer
- Dim r As Integer
- Dim s As Integer
- Dim t As Integer
- Dim i As Integer
- Set d = CreateObject("scripting.dictionary")
- myrow = ThisWorkbook.Sheets("工价").Range("a1").End(xlDown).Row
- r = ThisWorkbook.Sheets("工卡").Range("a1").End(xlDown).Row
- With ThisWorkbook.Sheets("工价")
- For s = 2 To myrow
- d(.Cells(s, "a").Value & .Cells(s, "c").Value & .Cells(s, "d").Value) = .Cells(s, "e").Value
- Next
- End With
- With ThisWorkbook.Sheets("工卡")
- For i = 2 To r
- .Cells(i, "h") = d(.Cells(i, "a").Value & .Cells(i, "e").Value & .Cells(i, "f").Value)
- Next
- End With
- Set d = Nothing
- End Sub
复制代码 |