下面提到的代码适用于" Workbook_BeforeSave"但我意识到,如果用户按两次保存代码粘贴两次。所以我需要运行"删除重复项"在上次粘贴之后关闭Proposal_Admin.xlsm之前。能不能请你帮帮我。
谢谢&问候。
Sub CopyToOtherCell()
Dim LastRow As Long, i As Integer, erow As Long
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 12).Value = Date Then
Range(Cells(i, 1), Cells(i, 12)).Select
Selection.Copy
Workbooks.Open Filename:="C:\Users\Murat\Documents\Teklifler\Proposal_Admin.xlsm"
ActiveWorkbook.Sheets("AdminSheet").Activate
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
ActiveSheet.Cells(erow, 1).Offset(1, 0).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
End If
Next i
End Sub
答案 0 :(得分:0)
您是否可以只查看工作簿是否已保存?
如果ThisWorkbook.Saved然后 '哇哇哇哇...... 结束如果