Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro run
How is it possible to start a macro immidiately after the Excel file is opened? Name the macro Auto_Open or use the Workbook_Open event procedure in the ThisWorkbook code module. The difference between these methods is that Auto_Open will not run if the workbook is opened via VBA code, while Workbook_Open will run regardless of how the workbook is opened (assuming EnableEvents is True). My other question is: how is it possible to run a macro when I step into a specified cell? Use SelectionChange event. In the code module of the worksheet containing the cell, use code like the following. This will run the 'your code here' code if the user selects cell A10. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub End If On Error GoTo ErrH: If Target.Address = "$A$10" Then Application.EnableEvents = False ''''''''''''''''''''''' ' your code here ''''''''''''''''''''''' End If ErrH: Application.EnableEvents = True End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "tomi12619" <tomi12619@laptop wrote in message ... Hi How is it possible to start a macro immidiately after the Excel file is opened? My other question is: how is it possible to run a macro when I step into a specified cell? Thank you in advance. Thomas |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
AutoRun Macro with a delay to give user the choice to cancel the macro | Excel Programming | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |