1

我有一个包含 2 个工作表的工作簿(1 个工作表称为最终工作表,1 个工作表称为待处理工作表),它们使用相同的列标题和列公式。

我很难找出一个宏/VBA,一旦第四列的状态从待定变为最终状态,它将帮助我自动将数据行从“待定”表传输到“最终”表。这样一来,未决客户和最终客户的所有数据都保存在单独的表格中。

请帮忙。

4

1 回答 1

0

在您的工作簿代码上尝试这样的事情:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Name = "pending" And Target.Column = 4 Then
    If Sh.Cells(Target.Row, Target.Column) = "final" Then
        Sh.Select
        Sh.Rows(LTrim(Str(Target.Row)) & ":" & LTrim(Str(Target.Row))).Select
        Selection.Copy ' or cut
        Sheets("final").Select
        Rows("20:20").Select ' here is your destination row... you must set a global to control it...
        Selection.Insert Shift:=xlDown
    End if
End Sub

祝你好运!

于 2011-02-01T19:07:25.480 回答