View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Cell Color changes On Input even if new input matches default

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("B10")) Is Nothing Then _
Range("B10").Interior.ColorIndex = xlNone
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"JBark" wrote:

Cell Color changes On Input even if new input matches default...

I have a Macro Button which sets a Range of Cells to this default:
(example)
Sub SetDefaultCells()
Range("B10").Value = "8:30 AM"
Range("B10").Interior.Color = vbYellow
End Sub

How can I place a code into this cell so that when the user changes the time
it changes the cell color? My problem is that the user may need to keep it at
8:30 AM, so can I change the cell color even if the user inputs the same data
if they key in the same data as the default? This is why I can not use
conditional formatting. I can't use onActive Cell either because when the
user hits Enter it will go to the next cell and if I use onClick the user may
not use the click function.

Any help is greatly appreciated. Thanks!