View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default A Boolean expression

On Sunday, April 26, 2015 at 9:20:40 AM UTC-7, Claus Busch wrote:
Hi Howard,

Am Sun, 26 Apr 2015 09:14:41 -0700 (PDT) schrieb L. Howard:

So if I select four cells and hit my Ctrl + q short cut, then cells are yellow with my letter in them.

If I select those same cells later and run the code then no color and no letter.


then try:

Sub CellColLetter()
'/ Ctrl + q

Dim rngC As Range

For Each rngC In Selection
rngC.Interior.ColorIndex = IIf(rngC.Interior.ColorIndex = xlNone, _
6, xlNone)
rngC = IIf(rngC = "", "A", "")
Next
End Sub


Regards
Claus B.


That does it, much cleaner than the With Selection.

Thanks.
Howard