|
-
May 24th, 2012, 09:15 AM
#1
Thread Starter
Frenzied Member
Excel VBA Range and Values not goin IN?
Any one help
trying to get this to work can change the fon and cell colour but cant put a value in the CELL
the C B A and AA
everytime have in the code they move it back to the top so only does the first cell P12-Q12
HTML Code:
Public Sub Worksheet_Change(ByVal Target As Range)
Set MyTotal = Range("P12:P391")
For Each Cell In MyTotal
If Cell.Value < 40 Then
Cell.Offset(0, 1).Interior.ColorIndex = 5 'BLUE
Cell.Offset(0, 1).Font.ColorIndex = 2 'BLACK
'cell.Offset(0, 1).Value = "C"
End If
If Cell.Value > 40 Then
Cell.Offset(0, 1).Interior.ColorIndex = 10 'GREEN
Cell.Offset(0, 1).Font.ColorIndex = 2 'BLACK
'cell.Offset(0, 1).Value = "B"
End If
If Cell.Value > 80 Then
Cell.Offset(0, 1).Interior.ColorIndex = 6 'YELLOW
Cell.Offset(0, 1).Font.ColorIndex = 0 'WHITE
'cell.Offset(0, 1).Value = "A"
End If
If Cell.Value > 120 Then
Cell.Offset(0, 1).Interior.ColorIndex = 3 'RED
Cell.Offset(0, 1).Font.ColorIndex = 2 'BLACK
' cell.Offset(0, 1).Value = "AA"
End If
If Cell.Value = 0 Then
'Cell.Offset(0, 1).Select
Cell.Offset(0, 1).Interior.ColorIndex = xlNone ' WHITE
Cell.Offset(0, 1).Font.ColorIndex = 0 'WHITE
End If
Next
End Sub
any help ?
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day

-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|