|
请教老师,想实现从一个工作表的单元格直接链接另一个工作表的单元格,因表格数据多,公式多,请问这段代码如何优化?
Sub 提取()
t = Timer
Dim i, x, y, rng As Range
x = Range("A65536").End(xlUp).Row
y = Sheets("方案").Range("A65536").End(xlUp).Row + 1
For i = 3 To x Step 1
For Each rng In Sheets("方案").Range("A3:A" & y)
If Cells(i, "A") <> "" And rng = Cells(i, "A") Then
Cells(i, "C").Formula = "=方案!" & Replace(rng.Address, "A", "C")
Cells(i, "D").Formula = "=方案!" & Replace(rng.Address, "A", "D")
Cells(i, "E").Formula = "=方案!" & Replace(rng.Address, "A", "E")
End If
Next
Next
MsgBox "提取完成!用时" & Timer - t & "秒!"
End Sub
|
|