View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default A Boolean expression

That does it, much cleaner than the With Selection.

Well...

Sub CellColLetter() '/ Ctrl + q
Dim n&
With Selection
For n = 1 To Selection.Cells.Count
Cells(n).Interior.ColorIndex = _
IIf(Cells(n).Interior.ColorIndex < 6, 6, xlNone)
Cells(n) = IIf(Cells(n).Interior.ColorIndex = 6, "A", "")
Next 'n
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion