2015-06-30 95 views
1

我已經完成了兩張高亮區別的比較。在我的vb /宏代碼中,我將缺少的ID複製到新工作表中。將數據插入最後一個單元格後的數據行

下面是代碼的一個片段:

If IsError(int_row_id) Then 
     'ID missing 
     id.EntireRow.Copy 
     missing.PasteSpecial xlPasteValuesAndNumberFormats 
     Application.CutCopyMode = False 
     Set missing = missing.Offset(RowOffset:=1) 

因此,如果ID丟失然後複製整個行並粘貼到薄片缺失。我想要做的是在數據被粘貼後的下一個單元格中的這一行數據的末尾添加短語「缺少新數據」

任何意見將不勝感激!

回答

0
If IsError(int_row_id) Then 
    With Sheets("missing") 
     last_row = .Cells(Rows.Count, 1).End(xlUp).Row 
     id.EntireRow.Copy Destination:=.Range("A"&last_row+1) 
     last_column = .Cells(last_row+1, .Columns.Count).End(xlToLeft).Column 
     .Cells(last_row+1, last_column+1) = "Missing from New Data" 
    End With 
相關問題