Hello there,
I am trying to move one worksheet to another workbook via macro assigned to a button. I have a worksheet named "Med A Audit (current test)" that I use as a blank form. Once I have completed the form, I would like to move it to another workbook where all the other audits that have been completed for the month are stored. I have tried the following code:
I wanted this macro to open the workbook that stored the months audits, transfer the completed audit, and then close out the audit without saving, so it remains a blank form. The macro successfully opens the other workbook but then gives me a "subscript out of range" notification. Everything but moving the worksheet works fine. I swear it worked at one point, but now it is not.
Originally, I wanted to be able to keep a blank form and then copy that for all new audits and keep everything (blank form and completed audits) in the same workbook, but I guess since I am copying the macro-enabled worksheet, it slows down excel really bad. This was my work around. If you have a solution to be able to do this, I would love to see it. The workbook that stores all the completed audits has all the worksheets hidden. If I need to refer back to one, I unhide only that one. It still slows down excel, but not quite to the point of seemingly becoming frozen, if I only have one worksheet unhidden at a time.
I am trying to move one worksheet to another workbook via macro assigned to a button. I have a worksheet named "Med A Audit (current test)" that I use as a blank form. Once I have completed the form, I would like to move it to another workbook where all the other audits that have been completed for the month are stored. I have tried the following code:
VBA Code:
Sub Transfer_Med_A_Audit()
'transfers completed Med A Audit then closes it out without saving.
Workbooks.Open Filename:="C:\Users\Paige\Documents\Work\2 Med A Audits\February 2025 Med A Audits.xlsm"
Sheets("Sheet17").Move after:=Workbooks("February 2025 Med A Audits.xlsm").Sheets("Sheet1")
Application.DisplayAlerts = False
Workbooks("Med A Audit (current test)").Close
Application.DisplayAlerts = True
End Sub
I wanted this macro to open the workbook that stored the months audits, transfer the completed audit, and then close out the audit without saving, so it remains a blank form. The macro successfully opens the other workbook but then gives me a "subscript out of range" notification. Everything but moving the worksheet works fine. I swear it worked at one point, but now it is not.
Originally, I wanted to be able to keep a blank form and then copy that for all new audits and keep everything (blank form and completed audits) in the same workbook, but I guess since I am copying the macro-enabled worksheet, it slows down excel really bad. This was my work around. If you have a solution to be able to do this, I would love to see it. The workbook that stores all the completed audits has all the worksheets hidden. If I need to refer back to one, I unhide only that one. It still slows down excel, but not quite to the point of seemingly becoming frozen, if I only have one worksheet unhidden at a time.