View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Francois via OfficeKB.com Francois via OfficeKB.com is offline
external usenet poster
 
Posts: 109
Default Toggle between original background colour and none

I'm trying to toggle the background colour of cells between whatever colour
they were to xlColorIndexNone and back again.

My code does it for one specified colour, but I can't work out how to modify
it for any other colours it may encounter.



Option Explicit
Dim lastCell As Range

Private Sub Worksheet_BEFOREDOUBLECLICK(ByVal Target As Range, CANCEL As
Boolean)

If Target.Interior.ColorIndex = 36 Then
Target.Interior.ColorIndex = xlColorIndexNone
Else: Target.Interior.ColorIndex = 36

End If

End Sub


I realise that I need to get the colorindex somewhere, but I'm not getting it
right

Thanks in advance

--
Message posted via http://www.officekb.com