我想根据其他工作表自动更新某些工作表中的行。所有这些都带有宏。
在第一步骤中,我有:
SheetA!A$1 = "first"
SheetA!A$2 = "second"
SheetA!A$3 = "third"
SheetB!A$1 = empty
SheetB!A$2 = empty
SheetB!A$2 = empty
然后我手动编辑SheetB!A $ 1
SheetA!A$1 = "first"
SheetA!A$2 = "second"
SheetA!A$3 = "third"
SheetB!A$1 = SheetA!A$1
SheetB!A$2 = empty
SheetB!A$2 = empty
现在宏开始了
SheetA!A$1 = "first"
SheetA!A$2 = "second"
SheetA!A$3 = "third"
SheetB!A$1 = SheetA!A$1
SheetB!A$2 = SheetA!A$2
SheetB!A$2 = SheetA!A$3
我希望将代码放入SheetB
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 'if changes in sheetB, col1
'TODO
End If
End Sub
这种自动复制的外观如何?
答案 0 :(得分:0)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
Sheets("SheetA").Cells(Target.Row, "A").Value = Target.Value
End If
End Sub