+ Reply to Thread
Results 1 to 2 of 2

After saving the invoice with new name using VBA code colors and format change

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2013
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2007
    Posts
    1

    After saving the invoice with new name using VBA code colors and format change

    Hi All,

    i was trying to generate the auto number and save the invoice by using the vba module. The code is below. It works ok but the only problem is that after creating the new file all colors and cell format automatically change. I want to have the same format in new file also can any body help me in this regard.

    Sub NextInvoice()
        Range("G8").Value = Range("G8").Value + 1
        Range("B13:G17,B20:G27").ClearContents
    End Sub
    
    Sub SaveInvWithNewName()
        Dim NewFN As Variant
        ' Copy Invoice to a new workbook
        ActiveSheet.Copy
        NewFN = "C:\Users\Finance\Documents\Data\DIS Data\Inv" & Range("G8").Value & ".xlsx"
        ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
        ActiveWorkbook.Close
        NextInvoice
    End Sub
    Last edited by poras; 06-23-2013 at 07:06 AM.

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: After saving the invoice with new name using VBA code colors and format change

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1