• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Generate the next invoice number without color changing in cells

xfiels

New Member
I'm a complete beginner at this stuff... hopefully someone can help me here...
I'm using the macro Bill Jelen posted on youtube to generate the next invoice number, however the colors in the cells are changing to other colors when it generates a new saved file...
I added ...
Range("A1:F42").Interior.Color = xlNone
but this clears all the colors out.. which I don't want..
The colors being used are unconventional to the normal format I'm guessing, so this is why they are changing to other colors probably.
can someone show me how to stop the colors from changing, and preserve them, when it creates the new file?
thanks in advance !

Code:
Sub NextInvoice()
Range("E5").Value = Range("E5").Value + 1
Range("A20:E39").ClearContents
End Sub
Sub SaveInvWithNewName()
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
Frank
 
Last edited by a moderator:
The colors are rgb 217, rgb 243, and rgb 236
I'm not sure why the colors are being changed by this macro,
but those are the original colors, and when the new page is generated, they get changed to a light blue, blue and purple
 
The file "TEST Inv.xlsm" was my quick fix, I changed the custom colors to one of the automatic colors.
Attached to this post is "TEST Inv(not working).xlsm" which is the one with custom colors, and will change to other colors when it gets copied to the new file.
I really wanted to use these custom colors, but for some reason when the copy happens, the custom colors get changed. But if you use just one of the default colors, then no change happens.
 

Attachments

  • TEST Inv (not working).xlsm
    46.8 KB · Views: 3
If you have color changed problem you can ask it from expert I think they can give you right decision to solve it. And I know invoice generate can create your invoice without color changing problem but I am not sure that about this kind of code that you shared here. Thanks
 
Back
Top