View Single Post
 
Old 10-25-2013, 10:12 AM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

You mean, how do you turn off this effect? If you want to do it permanently you can just delete the subroutine. But if you want to turn it off temporarily, I can think of two easy ways:

1) Change the name of the subroutine slightly. It's named "Worksheet_SelectionChange", and it must be to work automatically; so if you make the name "Worksheet_SelectionChange_Off" (for example), it will cease to work until you remove the extra characters.

2) The way I'd probably do it is add a line or two to the program, like this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Const Disabled = False
  If Disabled Then Exit Sub
  If Target.Cells.Count > 1 Then Exit Sub
  Target.Parent.Cells.Interior.ColorIndex = 0
  Target.EntireRow.Interior.ColorIndex = 8
  End Sub
The two lines I underlined are all that's different about this program; the rest does the same thing (or if it doesn't then I did it wrong). Any time you want to turn off the effect temporarily, go into the VBA Editor and change Disabled to True instead of False. Change it back to False when you want the effect back again.