+ Reply to Thread
Results 1 to 8 of 8

Macro to save certain sheets from excel automatically

  1. #1
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Smile Macro to save certain sheets from excel automatically

    Hi there,

    I'm not sure if this is possible but I want to be able to click print and after it has printed, transferred and cleared I would like it to save the purchase order and continuation sheet.

    If this is being done on different computers is it possible for it to simply bring up the dialog box and the user save it where they would like?

    All help appreciated

    Many Thanks

    Libby
    Attached Files Attached Files
    Last edited by Libster78; 01-26-2010 at 07:18 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to save certain sheets from excel automatically

    Something like this should do the trick:

    Please Login or Register  to view this content.
    Change the sheet names as required.

    Dom
    Last edited by Domski; 01-22-2010 at 07:27 AM.
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Macro to save certain sheets from excel automatically

    Fab thank you
    Libby

  4. #4
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Macro to save certain sheets from excel automatically

    Hi there

    Sorry I did do this but it is the sheets that have been copied which I want to save.

    is there a change in the code for this?

    Thanks

  5. #5
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Macro to save certain sheets from excel automatically

    I tried
    Please Login or Register  to view this content.
    but it is not saving the sheets I have copied. how do I change the code?

    Thanks in advance

    Libster78
    Last edited by Libster78; 01-25-2010 at 10:44 AM.

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to save certain sheets from excel automatically

    Do you mean you are copying the sheets to a new workbook and then running the code? The code does the copying for you here:

    Please Login or Register  to view this content.
    Please use code tags when posting code.

    Dom

  7. #7
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Macro to save certain sheets from excel automatically

    Dom,

    I am sorry the save seems to be working fine. It must have been me.

    Can you have a look at my full code and see if you can see why when I click the print the code stops at NewInvoice1 and says
    run time error "1004", Unable to set Locked property of the Range class
    It seems to work on its own but not the way I have put it in to the IF code unde PrintInvoice()

    Thanks

  8. #8
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to save certain sheets from excel automatically

    I tried running the code and it did work okay without an error for me but would point out a couple things...

    I think your Invoice code can be cut down to this:

    Please Login or Register  to view this content.
    All the locking and unlocking of cells seemed to be unnecessary.

    You've used merged cells quite a lot which VBA really doesn't like, I would suggest changing all the merged cells to Center Across Selection as this will throw up less possible errors.

    Hope it helps,

    Dom

+ 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