Macro Stopped Working the same way

tsymic

New Member
Joined
Oct 1, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
My macro was working for a month or two. We added a printer, so we changed it for the printer. Now it won't save properly, nor will it increase the invoice number properly. As in, when I run it, I will be asked if I want to save the page, when it is supposed to save automatically. Also, the new invoice will save a 1, but the invoice number on the workbook is 2.

Also, a more minor issue, is when I go to use the macro again, all tabs (worksheets) are highlighted. I'm not sure why.

Sub NextInvoice()
' Keyboard Shortcut: Ctrl+q

Worksheets.PrintOut _
From:=1, _
To:=1, _
Copies:=1, _
ActivePrinter:="SHARP MX-M365N PCL6"

Dim NewFN As Variant
' Copy Invoice to new workbook
ActiveSheet.Copy
Range("B14").Value = Range("B14").Value
NewFN = "C:\Users\anviladmin\anvilmachine.ca\Document Portal - Documents\Work Orders\" & Range("P6").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
Range("B14").Formula = "=TODAY()"
ActiveWorkbook.Close
Range("P6").Value = Range("P6").Value + 1
Range("J9, J11, O11:Q11, J12, J15:Q16, J17:Q17, J18:Q28").ClearContents
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I found my error. Sorry to bother everyone. I don't know how to delete or edit the post.
Range("B14").Formula = "=TODAY()"
The above shouldn't have been there.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top