Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kelly!
How 'bout this: - copy your procedure code into its own procedure name (e.g. 'foo') - declare a global boolean variable (e.g. blnRun) and set you procedure to run only if blnRun is True. Whenever your code is ready to change a color, set blnRun to False change your color, then reset blnRun to True again after i.e. Code ------------------- : : blnRun = False {change color code} blnRun = True : : Private Sub Worksheet_SelectionChange(ByVal Target As Range) if blnRun then call Foo(Target) end if End Sub Private Sub Foo(ByVal targ as Range) Static rOldCell As Range If Not rOldCell Is Nothing Then If Not Intersect(rOldCell, Range("A1")) Is Nothing Then 'your code here End If End If Set rOldCell = targ End Sub ------------------- fendwick * That worked but I created a new problem. Within my code I am changeing the interior color of several diferent ranges and each time I have a ".select" in my code the "Worksheet_SelectionChange" code runs again. Sort of like a circular referance I guess? Anyway is there a way to change the color of a named range without actually selecting the range and setting off the Worksheet_SelectionChange code every time? Other ideas? Thanks Kelly -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run macro on exit | Excel Discussion (Misc queries) | |||
Macro on exit cell | Excel Discussion (Misc queries) | |||
How do I exit a macro subroutine? | Excel Worksheet Functions | |||
Exit via macro only? | Excel Discussion (Misc queries) | |||
on exit macro | Excel Discussion (Misc queries) |