Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Run Auto Macro only once
I need to run an Auto Macro only the first time a file is opened. On
subsequesnt opening of the file, no action should occur. Any help is appreciated. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Run Auto Macro only once
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Res As Variant On Error Resume Next Res = ThisWorkbook.Names("RunOnce").Value If IsEmpty(Res) Then MsgBox "Run Once Code" End If ThisWorkbook.Names.Add "RunOnce", "TRUE" End Sub You can reset it by deleting the name "RunOnce" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC -- Don Guillett SalesAid Software "Jim D" wrote in message ... I need to run an Auto Macro only the first time a file is opened. On subsequesnt opening of the file, no action should occur. Any help is appreciated. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Run Auto Macro only once
Have the Macro look for some value in a cell, (which may be a hidden cell if
you wish), and quit if it finds it. Later in the Macro have the Macro place the value that it will look for the next time that it runs. The Macro will therfore only run the first time or if you delete the value in the cell. -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings with @tiscali.co.uk "Jim D" wrote in message ... I need to run an Auto Macro only the first time a file is opened. On subsequesnt opening of the file, no action should occur. Any help is appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro Auto Run(2) | Excel Worksheet Functions | |||
Macro - Auto Run | Excel Worksheet Functions | |||
macro for auto sum | New Users to Excel | |||
Auto Run a Macro | Excel Discussion (Misc queries) |