You are assigning xlsx extension to the file name variable and trying to save a workbook with vba code that needs to be xlsm extension.
Also, the file format for macro enabled workbook is FileFormat:=xlOpenXMLWorkbookMacroEnabled
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You are assigning xlsx extension to the file name variable and trying to save a workbook with vba code that needs to be xlsm extension.
Also, the file format for macro enabled workbook is FileFormat:=xlOpenXMLWorkbookMacroEnabled
Would this be correct then?
Sub PostToRegister()
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Set WS1 = Worksheets("PCSheet")
Set WS2 = Worksheets("Register")
'Figure out which row is the next row'
nextRow = WS2.Cells(Rows.Count, 1).End(xlUp).Row + 1
'Write the important values to the register'
WS2.Cells(nextRow, 1).Resize(1, 5).Value = Array(WS1.Range("G4"), WS1.Range("F1"), WS1.Range("G3"), WS1.Range("G5"), WS1.Range("H56"))
End Sub
Sub NextPCSheet()
Range("C10").Value = Range("C10").Value + 1
Range("B16:G54").ClearContents
Range("L33:M57").ClearContents
Range("G4:H4").ClearContents
Range("C2:C3").ClearContents
End Sub
Sub SavePCSheetWithNewName()
Dim NewFN As Variant
PostToRegister
ActiveSheet.Copy
NewFN = "M:\Powder Coat\Supermarket saved PC sheets" & Range("F1").Value & ".xlsm"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
NextPCSheet
End Sub