I want to make it so that if cell A1 has a negative value in it, say -10, that cells A1 and B1 both have the same fill color (red). I want it to be done automatically as soon as the value is entered into A1. How do I do this. Thanks
I want to make it so that if cell A1 has a negative value in it, say -10, that cells A1 and B1 both have the same fill color (red). I want it to be done automatically as soon as the value is entered into A1. How do I do this. Thanks
watido,
Select Cells A1:B1, then click on Conditional Formatting (not sure exactly where it is in Excel 2007 - I think it's in the ribbon. Click New Rule, Use a formula to determine which cells to format, then type/copy:
Select your formatting, then Ok/Apply your way out, and you're done.![]()
=$A$1<0
Brendan.
__________________________________________________________________________________________________
Things to consider:
1) You can thank any poster by clicking the * at the left of a helpful post.
2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.
thanks BB1972, that was a lot easier than I thought it would be.
You can use this code that will change the cells on leaving the cell A1
![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Not Application.Intersect(Range("A1"), Target) Is Nothing Then If Target.Value < 0 Then Range("A1:B1").Interior.Color = vbRed Else With Range("A1:B1").Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With End If End If End Sub
Regards
Sean
Please add to my reputation if you think i helped (click on the star below the post)
Mark threads as "Solved" if you have your answer (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [code]
Please supply a workbook containing example Data: It makes its easier to answer your problem & saves time!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks