View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default conditional formatting, when select a cell.

Saad,

You could use the selection change event. Copy the code below, right-click the sheet tab, select
"View Code" and paste the code in the window that appears.

The code will change the fill of cell A2 to red when B2 is selected.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$2" Then
Range("A2").Interior.ColorIndex = 3
Else
Range("A2").Interior.ColorIndex = xlNone
End If
End Sub


"Saad" wrote in message
...
hi,
i want to make conditional formatting to a cell (say A2) only of i selct
B2...how to write this select command in contional formatting box?