View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Help with If Not Intersect

Derek,

Try this, It's a bit more intensive, but works

Private Sub workbook_sheetchange(ByVal sh As Object, ByVal Target As Range)
Dim cell As Range
On Error Resume Next

For Each cell In Target
If Not Intersect(cell, Range("f5:f33")) Is Nothing Then
If cell.Value = 0.5 Then
cell.Font.ColorIndex = 3
cell.Font.FontStyle = "bold"
Else
cell.Font.ColorIndex = 1
cell.Font.FontStyle = "normal"
End If
End If
Next cell
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"derek" wrote in message
...
Excel 2000
With a previous question and your help I'm up and running
with the code below. But I need a last bit of help please
to find away round a glitch..
Users enter data into the sheet within a range of C5:H33.
For ease they sometime copy and paste part of a row into
the next row but sometime paste it into the wrong cell.
The result is the red/bold format if present in the F5:F33
(from the code below) is transfered to another cell. How
can I ensure that all other cells other than the F5:F33
range remains black and normal when data is enterd either
directly or copied from a cell with red/bold format?

Private Sub workbook_sheetchange(ByVal sh As Object, ByVal
Target As Range)
On Error Resume Next

If Not Intersect(Target, Range("f5:f33")) Is Nothing Then
If Target.Value = 0.5 Then
Target.Font.ColorIndex = 3: Target.Font.FontStyle = "bold"
Else
Target.Font.ColorIndex = 1: Target.Font.FontStyle
= "normal"
End If
End If
End Sub

TIA Derek..