且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据从一个Excel工作表复制到另一工作表

更新时间:2022-12-11 23:22:35

您需要挂钩工作表的SelectionChange事件.

进入VB编辑器(Alt + F11).

双击Sheet2对象.

在左侧的下拉框中,选择工作表".那应该会自动添加SelectionChange事件.

如果不是,请使用右下拉菜单选择SelectionChange.

然后,在代码块中,只需编写:
You need to hook the worksheet''s SelectionChange event.

Go into the VB editor (Alt+F11).

Double-Click the Sheet2 Object.

In the left drop-down box, select Worksheet. That should automatically add a SelectionChange event.

If not, use the right drop-down to select SelectionChange.

Then, in the code block, just write:
Sheet1.Range("A2").Value = Target.Value