View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Change Format of Active Cell

magmike formulated the question :
On Jul 15, 5:57*pm, Gord wrote:
Thanks Garry

I uninstalled 2007 a while back so had no way to test.

I originally posted that "fix" a couple years ago when someone wanted
a better visual on a selection of multiple cells.

Forgot about a single selection.

I like this from Mike H. which restores existing formatting of any
type.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'cell highlighter
'Mike H.........does not destroy existing formats
Cells.FormatConditions.Delete
With Target
* * .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
* * With .FormatConditions(1)
* * * * .Interior.ColorIndex = 6
* * End With
End With
End Sub

Gord



On Fri, 15 Jul 2011 18:24:18 -0400, GS wrote:
Gord, your suggestion doesn't address the active cell, only those
selected along with it (if any).


Not sure why the active cell indicator doesn't work well enough for
magmike, but maybe '_SelectionChange' is the right event to use with
appropriate code. Problem is how to manage non-active cells once
active, and so maybe a global variable to hold its address, which gets
used to clear formatting BEFORE the current active cell's address gets
put into it for next time.- Hide quoted text -


- Show quoted text -


Actually, this destroyed the Conditional formatting of EVERY cell once
I made my first selection! Thanks for trying though ;)


Not sure why this is happening for you. My existing cell formats remain
intact, and so the code works fine 'as is'!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc