Sub 修改并保存()
Dim I
X = WorksheetFunction.Match([B1], Sheets("基础数据").Range("A:A"), 0)
Range("A3:D3").Copy Sheets("基础数据").Cells(X, "a")
Sheets("基础数据").Select
Sheets("基础数据").Range("a" & X & ":" & "d" & X).Interior.ColorIndex = 3 '修改过的区域填充红色
End Sub
代码复制到 修改表里
Sub 修改()
Dim i%,j%
For i=2 to 5000
if sheets(2).cells(i,"A")=sheets(1).cells(1,"B") then
sheets(2).cells(i,"B")=sheets(1).cells(2"B")
sheets(2).cells(i,"C")=sheets(1).cells(2"C")
sheets(2).cells(i,"D")=sheets(1).cells(2"D")
end if
Next i
End Sub