+ Reply to Thread
Results 1 to 5 of 5

macro to run automatically

  1. #1
    Forum Contributor vandanavai's Avatar
    Join Date
    09-04-2006
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    256

    macro to run automatically

    Hi,

    I don't konw if this is possible. I have on macro which copies formula in Range A1: A10 and paste values in same range ( through paste special - values). Everytime before file is saved and closed, user has to run this macro. But sometinmes user forgets to do so and some problem is to be faced. So I want to run this macro automatically when file is saved and closed

    Please help me.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by vandanavai
    Hi,

    I don't konw if this is possible. I have on macro which copies formula in Range A1: A10 and paste values in same range ( through paste special - values). Everytime before file is saved and closed, user has to run this macro. But sometinmes user forgets to do so and some problem is to be faced. So I want to run this macro automatically when file is saved and closed

    Please help me.
    Hi,

    Please Login or Register  to view this content.
    should work, paste this into the Workbook (Alt & F11 for VB Editor, select Workbook )

    Let me know how you go
    ---


    ---
    Last edited by Bryan Hessey; 12-03-2006 at 03:11 AM.
    Si fractum non sit, noli id reficere.

  3. #3
    Forum Contributor vandanavai's Avatar
    Join Date
    09-04-2006
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    256
    Thanks Bryan for code. I tried it but it didn,t work. Please help

  4. #4
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122
    the code above does the copying, but does not seem to do "the save", the user would still have to confirm the save on exit of the file

    Add this line to the end of the code above.

    ThisWorkbook.Close savechanges:=True

    then they have no option

    hth

  5. #5
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by peejay
    the code above does the copying, but does not seem to do "the save", the user would still have to confirm the save on exit of the file

    Add this line to the end of the code above.

    ThisWorkbook.Close savechanges:=True

    then they have no option

    hth
    Hi peejay,


    vandanavai "Thanks Bryan for code. I tried it but it didn,t work"


    can you explain what 'didn't work' - the code copies the A1:A10 of the sheet that is active at close, it didn't force a save, but peejay's addition will do that.

    Did your A1:A10 cells still have formula?

    or did your original post mean that you want the close to run your unnamed macro?


    ---

+ 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