请求论坛大神帮忙精简代码,只复制值,不要格式谢谢!
Private Sub Worksheet_Change(ByVal TargetAs Range) If Target.Column = 13 Then If InStr(Target, "离职") Then Cells(Target.Row, 2).Copy Sheets("停保人员明细").Range("B" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row + 1) Cells(Target.Row, 3).Copy Sheets("停保人员明细").Range("C" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 4).Copy Sheets("停保人员明细").Range("D" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 5).Copy Sheets("停保人员明细").Range("E" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 6).Copy Sheets("停保人员明细").Range("F" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 7).Copy Sheets("停保人员明细").Range("G" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 8).Copy Sheets("停保人员明细").Range("H" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 9).Copy Sheets("停保人员明细").Range("I" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Cells(Target.Row, 10).Copy Sheets("停保人员明细").Range("J" & Sheets("停保人员明细").Cells(Rows.Count, 5).End(xlUp).Row) Sheets("停保人员明细").Range("L"& Sheets("停保人员明细").Cells(Rows.Count,5).End(xlUp).Row) = Date Target.EntireRow.Delete End If End If End Sub
|