Need to insert value based on Background Color - 8KB Attach
Sub Macro2()
Dim cell as Range
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub
Just select one or more cells.
less robust (only works on one cell)
Sub Macro2()
Select Case Activecell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
End Sub
--
Regards,
Tom Ogilvy
"RT" wrote in message
...
You need to check the interior.colorindex of the cells, but for the
"standard" colors:
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 3 'Red
Cell.Value = "Severe"
Case 4 'Green
cell.Value = "Slight"
Case 6 'Yellow
Cell.Value = "Minor"
End Select
Next
--
Regards,
Tom Ogilvy
In trying to get this working on just one cell I've tried:
Sub Macro2()
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
End Sub
What am i leaving out?
|