This code saves me a 5 minutes several times a day.
I fill in a stock acceptence document, export the data to another worksheet that summarises this data, save a copy of the acceptance sheet to a folder, then print the sheet.
I'm using the range E11:H52, although the data is mostly not filling this range it is always within it.
There is an additional step that I need to complete before I've finished this task, I need to add the date from cell D4 into column G, the value from cell D8 into column H, and the week number for the date in D4 into column I, I do this for every row of data that has been copied across.
Hope this makes sense and that someone might be able to help with this.
I fill in a stock acceptence document, export the data to another worksheet that summarises this data, save a copy of the acceptance sheet to a folder, then print the sheet.
I'm using the range E11:H52, although the data is mostly not filling this range it is always within it.
There is an additional step that I need to complete before I've finished this task, I need to add the date from cell D4 into column G, the value from cell D8 into column H, and the week number for the date in D4 into column I, I do this for every row of data that has been copied across.
Hope this makes sense and that someone might be able to help with this.
Code:
Sub SaveCopyPrintClose()
Dim newFile As String
Dim Import As Workbook
Dim Export As Workbook
Dim fName As String
Set Import = Workbooks.Open("F:\Desktop\Summary.xlsm")
Set Export = Workbooks("Stock Acceptance Sheet BLANK.xlsm")
fName = Export.Sheets("Sheet 1").Range("D4").Value
With Export.Sheets("Sheet 1").Range("E11:H52")
Import.Sheets("Stock In").Range("C" & Rows.Count).End(xlUp).Offset(1).Resize( _
.Rows.Count, .Columns.Count) = .Value
End With
newFile = "Stock Acceptance Sheet - " & fName & ".xlsm"
ChDir _
"F:\Desktop\New Folder"
Export.PrintOut
Export.SaveAs Filename:=newFile
Export.Close
Import.Save
Import.Close
End Sub