清除单元格数据后是否可以插入宏指令?

时间:2017-03-29 12:02:24

标签: excel-vba vba excel

我有一个工作表,其中包含几个单元格,用于指示用户在每个单元格中写入的内容。为此,用户在读取指令并输入数据后删除该指令。然后他们点击一个宏按钮来保存和清除数据。我的问题是我希望指令存在于下一个用户而不是空白单元格。

以下是我所拥有的:

Sub NEXTINVOICE()
    Range("C7").value = Range("C7").value + 1
    Range("A13:A13, A16:C42, C9:D9").ClearContents
    Sheets("PROCESS SHEET").Range("B7:C9, A15:G67, B71:B75, G84:G204").ClearContents
    Sheets("PROCESS SHEET (2)").Range("B7:C9, A15:G67, B71:B75, G84:G204").ClearContents
    Sheets("PROCESS SHEET (3)").Range("B7:C9, A15:G67, B71:B75, G84:G204").ClearContents
    Sheets("PROCESS SHEET (4)").Range("B7:C9, A15:G67, B71:B75, G84:G204").ClearContents
    Sheets("PROCESS SHEET (5)").Range("B7:C9, A15:G67, B71:B75, G84:G204").ClearContents
    Sheets("DOOR & LINER PRICES").Range("B18:B105, B123:B211, B228:B243, B247:B251, B256:B264").ClearContents
    Sheets("TIMBER CALCULATOR").Range("A5:A5, A8:A8, A12:B12, A16:B16, A23:B23, E12:E12, E16:E16, E23:E23").ClearContents
End Sub

Sub SaveInvWithNewName()
    Dim NewFN As Variant
    ActiveWorkbook.Sheets.Copy
    NewFN = "\\NASDE8FB1\MCM Cloud\Estimating\Quote Numbers\QUOTE_MR_" & ThisWorkbook.Sheets("QUOTE SHEET").Range("C7").value & ".xlsx"
    ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
    ActiveWorkbook.Close
    NEXTINVOICE
End Sub

0 个答案:

没有答案