Good day all,
I currently have a master file with all my data, I then have the below VBA that duplicates and renames a template file that has formulas in as per my list and saves these documents in excel format.
The template that is duplicate and renamed has formuals that filters and looks up certain data based on the file name it is saved as. Currently once I have run my VBA I have to open all the documents it creates and manually copy and past all the data as values. Is there a way to my VBA so that when it duplicates and renames the file it copies/pastes the data it pulls through as a the value rather than as the formula.
I am a complete novice with VBAs and haev created it based on a youtube video and notes.
Sub SaveMasterAs()
Dim wb As Workbook
Dim rNames As Range, c As Range, r As Range
'Current file's list of names and ids on sheet1.
Set rNames = Worksheets("Orders").Range("A2", Worksheets("Orders").Range("A2").End(xlDown))
'Path and name to master workbook to open for copy, saveas.
Set wb = Workbooks.Open(ThisWorkbook.Path & "\ReturnTemplate.xlsx")
For Each c In rNames
With wb
'.Worksheets("Sheet1").Range("A1").Value = c.Offset(, 1).Value 'ID
'Path and name for copied workbook
.SaveAs Filename:=ThisWorkbook.Path & "\Return Files\" & c.Value & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End With
Set wb = ActiveWorkbook
Next c
wb.Close
End Sub
I currently have a master file with all my data, I then have the below VBA that duplicates and renames a template file that has formulas in as per my list and saves these documents in excel format.
The template that is duplicate and renamed has formuals that filters and looks up certain data based on the file name it is saved as. Currently once I have run my VBA I have to open all the documents it creates and manually copy and past all the data as values. Is there a way to my VBA so that when it duplicates and renames the file it copies/pastes the data it pulls through as a the value rather than as the formula.
I am a complete novice with VBAs and haev created it based on a youtube video and notes.
Sub SaveMasterAs()
Dim wb As Workbook
Dim rNames As Range, c As Range, r As Range
'Current file's list of names and ids on sheet1.
Set rNames = Worksheets("Orders").Range("A2", Worksheets("Orders").Range("A2").End(xlDown))
'Path and name to master workbook to open for copy, saveas.
Set wb = Workbooks.Open(ThisWorkbook.Path & "\ReturnTemplate.xlsx")
For Each c In rNames
With wb
'.Worksheets("Sheet1").Range("A1").Value = c.Offset(, 1).Value 'ID
'Path and name for copied workbook
.SaveAs Filename:=ThisWorkbook.Path & "\Return Files\" & c.Value & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End With
Set wb = ActiveWorkbook
Next c
wb.Close
End Sub