Row watch and single cell change

BMD

Board Regular
Joined
Oct 5, 2005
Messages
211
All,
I did a search for 'Rows' and tryed to modify what I found.
This needs to watch row 7 and 15 and 16 and 23, if it finds a '%100' smiple make it green, but only that cell and not the whole row and the %100 is a formula and not entered.

Bruce.
 
I don't think so as I will have many (six) or more changes to make and that is why I had to use the code in ThisWorkbook as that makes five changes based on two columns of data. Is there a way to watch other sheets or can I have an update button to run the code.

Thanks,
Bruce.
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I tryed a simple command button
Code:
Private Sub CommandButton1_Click()
If (Range("B7:Q7")) Is Nothing Then Exit Sub
    If Target.Value > 0.01 And Target.Value < 0.25 Then
        Target.Font.Bold = True
        Target.Font.ColorIndex = 3
    ElseIf Target.Value > 0.25 And Target.Value < 0.5 Then
        Target.Font.Bold = False
        Target.Font.ColorIndex = 42
    ElseIf Target.Value > 0.5 And Target.Value < 0.75 Then
        Target.Font.Bold = True
        Target.Font.ColorIndex = 5
    ElseIf Target.Value > 0.9 And Target.Value < 0.95 Then
        Target.Font.Bold = False
        Target.Font.ColorIndex = 50
    ElseIf Target.Value > 0.95 Then
        Target.Font.Bold = True
        Target.Font.ColorIndex = 50
    Else
        Target.Font.Bold = False
        Target.Font.ColorIndex = 1
    End If

End Sub
This is a problem with the range command in line two
 
Upvote 0
Bruce

That code isn't right. For a start there is no Target, in the other code this is a parameter passed to the event routine that refers to the changed range.

Also this will either always be false or will cause an error.
Code:
If (Range("B7:Q7")) Is Nothing Then Exit Sub

Does this work?
Code:
Private Sub CommandButton1_Click()
Dim rng As Range
Dim c As Range

    Set rng = Range("B7:Q7")
    
    For Each c In rng.Cells
        Select Case c.Value
            Case Is > 0.01, Is < 0.25
                c.Font.Bold = True
                c.Font.ColorIndex = 3
            Case Is > 0.25, Is < 0.5
                c.Font.Bold = False
                c.Font.ColorIndex = 42
            Case Is > 0.5, Is < 0.75
                c.Font.Bold = True
                c.Font.ColorIndex = 5
            Case Is > 0.9, Is < 0.95
                c.Font.Bold = False
                c.Font.ColorIndex = 50
            Case Is > 0.95
                c.Font.Bold = True
                c.Font.ColorIndex = 50
            Case Else
                c.Font.Bold = False
                c.Font.ColorIndex = 1
        End Select
    Next c
    
End Sub
 
Upvote 0
My last post doesn't work.

Try this.
Code:
Private Sub CommandButton1_Click()
Dim rng As Range
Dim c As Range

    Set rng = Range("B7:Q7")
    
    For Each c In rng.Cells
        Select Case c.Value
            Case 0.01 To 0.25
                c.Font.Bold = True
                c.Font.ColorIndex = 3
            Case 0.25 To 0.5
                c.Font.Bold = False
                c.Font.ColorIndex = 42
            Case 0.5 To 0.75
                c.Font.Bold = True
                c.Font.ColorIndex = 5
            Case 0.9 To 0.95
                c.Font.Bold = False
                c.Font.ColorIndex = 50
            Case 0.95
                c.Font.Bold = True
                c.Font.ColorIndex = 50
            Case Else
                c.Font.Bold = False
                c.Font.ColorIndex = 1
        End Select
    Next c
    
End Sub
 
Upvote 0
allmost but it updates the whole row,,, but C7 should be this and H7 should be something else. I just need to update each cell in the row.

THANKS,
Bruce.
I think I owe you lunch.
 
Upvote 0
Bruce

I don't understand your last post.
 
Upvote 0
If C7=.99 it should match a case statement and change the color to X. at the same time if H7=.21 it should match a different case statement and change accordingly. Now if an undates happens everthing turns 3,bold.

Bruce.
 
Upvote 0
Bruce

Did you see the last code I posted?

I made a mistake in the first post with the syntax of the case statements conditions.
 
Upvote 0
Lunch is on me....... All I have to do is get the number from management and modify the code.

Norie, Your the Best.
I'm also reading up on Nauru, sounds like a quiet place except the unemployment rate.
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top