Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Databases (https://www.askmehelpdesk.com/forumdisplay.php?f=444)
-   -   Auto-Macro in Excel (https://www.askmehelpdesk.com/showthread.php?t=164481)

  • Dec 20, 2007, 10:18 AM
    Wonder84lalala
    Auto-Macro in Excel
    Hi,

    I have a lot of macros built-in Excel, but when I want to update the certain data , I have to run them individually each time. Do you know anyway I can auto-run these macros?

    Thanks for any help.
  • Jan 7, 2008, 06:23 AM
    Duane in Japan
    I do not have a straight answer for you from within Excel, except to say that I believe you could write a VBA code to do this for you but I do not know VBA well enough to point you in the correct direction.

    If you get the pay version (cheap) of Aldos Macro Recorder, there is a section built in that if an entry is made, the macro will run, since it is separate from Excel, Aldos Macro will run your Excel Macro and there you have it.

    I also believe that you could build a Visual Studio 2005 or 2008 beta program to do exactly what you want but there is a learning curve, but there is tons of help available, and I have plenty of info for those sites too.

    I am thinking that if a cell is updated on your Excel sheet, then there could be a shortcut created in the cell (hyperlink) or the cell next to the updated info and you could easily access the hyperlink directly from the updated cell or its neighboring cell with ease, this is the easiest fix I think, yes it still manual but you will not have to drill down through the macro listing to find it, the exact macro of choice is right there in a hyperlink or shortcut.
  • Mar 8, 2008, 04:17 PM
    tbakry
    You can do an autoexec but there are security implications. I think what you are looking for is Auto_open() It is a VBA module. I believe that it may require you to modify your security settings to work. If you go into the VB editor you can create a module called Auto_open(). Here is an example of one that I did to print off multiplication table worksheets for my kids:
    Create a VB module
    example:

    Sub Auto_Open()
    '
    ' Multiprint Macro
    ' Print Multiplication Practice Sheets
    '

    '
    Workbooks.Open Filename:= _
    "C:\Documents and Settings\Martha\My Documents\xls\Andy Multiplication.xls"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    Workbooks.Open Filename:= _
    "C:\Documents and Settings\Martha\My Documents\xls\Joe Multiplication.xls"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    ActiveWorkbook.Close
    ActiveWorkbook.Close
    End Sub

    The macro is saved into a specific worksheet and when the worksheet is launched, it automatically executes. The worksheet does prompt me to allow macros.

    Cheers,
    Tom
  • Dec 4, 2008, 10:34 PM
    valleyboy08

    I guess you can use this for your purpose Activeworkbook.RunAutoMacros xlAutoOpen
  • Jan 15, 2009, 05:46 PM
    TheCodeCageTeam
    Quote:

    Originally Posted by Wonder84lalala View Post
    Hi,

    I have a lot of macros built-in Excel, but when I want to update the certain data , I have to run them individually each time. Do you know anyway I can auto-run these macros?

    Thanks for any help.

    You simply CALL the macro's one after the other like this (I've used code that should go in the ThisWorkbook module (Alt+F11))
    Code:

    Private Sub Workbook_Open()
    Call Macro1
    Call Macro2
    Call Macro3
    '....etc
    End Sub

    Replace Macro1... etc for you macro name.

  • All times are GMT -7. The time now is 05:48 PM.