Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All...........
Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could have the macro, as the first step, check what ever unique
condition it imposes and if it appears it has run, then exit. It will still run, but will exit without doing anything. -- Tom Ogilvy "CLR" wrote: Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cool........that should work for my immediate requirement.........
Thanks, Tom Vaya con Dios, Chuck, CABGx3 "Tom Ogilvy" wrote: You could have the macro, as the first step, check what ever unique condition it imposes and if it appears it has run, then exit. It will still run, but will exit without doing anything. -- Tom Ogilvy "CLR" wrote: Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are probably a number of ways, but I would get it to create a Name
(hidden) with a particular reference when it runs. Then, at the start of the SelectionChange event you could look at the name to see the value and run it or not based on that. Jeff "CLR" wrote in message ... Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ah-ha..........increased security......
Thanks, Jeff Vaya con Dios, Chuck, CABGx3 "Jeff Standen" wrote: There are probably a number of ways, but I would get it to create a Name (hidden) with a particular reference when it runs. Then, at the start of the SelectionChange event you could look at the name to see the value and run it or not based on that. Jeff "CLR" wrote in message ... Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chuck,
Try something like 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 www.cpearson.com "CLR" wrote in message ... Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey now....THAT is some cool.........Thanks Chip.
Vaya con Dios, Chuck, CABGx3 "Chip Pearson" wrote: Chuck, Try something like 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 www.cpearson.com "CLR" wrote in message ... Hi All........... Is there a way to have a SelectionChange macro set up so it will run the first time it's called upon, and as a last item, disable itself to never run again unless "reset"? TIA Vaya con Dios, Chuck, CABGx3 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in 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 |