Facing problem with merge cells to drive into next Invoice number and Save a backup file into my desire folder.

MD Didarul Islam

New Member
Joined
Jul 5, 2018
Messages
2
Sir,
I am creating a Automatic Invoice and i merge some cell for beauty of my Invoice but when i assign a button into macro,
it says the macro can not work for merge cells. So how to save my file to keep merge cells .If you have any solution for that please give me information. Below i mentioned the code for Next invoice
number and for Save file. I note the cod from your You Tube channel .


Sub NextInvoice()
Range("E5").Value = Range("E5").Value + 1
Range("A20:E39").ClearContents
End Sub


Sub SaveInvoiceWithNewName()
Dim NewFN As Variant
' Copy Invoice to a New Workbook
ActiveSheet.Copy
NewFN = "C:\aaa\Inv" & Range("E5").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextInvoice
End Sub


Thank You
MD Didarul Islam
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi & welcome to the MrExcel
As you have discovered macros & merged cells do not go well together.
It's best to avoid merged cells completely, whilst they may make things look "pretty" they are simply not worth the trouble.
If you are merging cells in 1 row use Centre across selection instead.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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