Hi
Could anybody tell me how to add an additional colour to this code
at the moment if text is entered with N-SIDE all the related cells will go yellow
I have been trying to add it the text is ADD then they should turn pink.
This is probably simple but not to me
Code:Sub shadeCells(rangeToShade As Range, Target_Name As String) Dim Shaded(1 To 9) As Long, i As Integer, j As Integer Dim myColor As Long If UCase(Left(Target_Name, 6)) = "N-SIDE" Then myColor = 65535 Else myColor = 4050606 End If 'Set the shading color numbers for each column Shaded(1) = myColor 'Col A Shaded(2) = myColor 'Col B Shaded(3) = myColor 'Col C Shaded(4) = myColor 'Col D Shaded(5) = myColor 'Col E Shaded(6) = myColor 'Col F Shaded(7) = myColor 'Col G Shaded(8) = myColor 'Col H Shaded(9) = myColor 'Col I For j = 1 To rangeToShade.Rows.Count For i = 1 To 9 Cells(rangeToShade.Rows(j).Row, i).Interior.Color = Shaded(i) Next Next End Sub
Thank you for looking
Peter




Reply With Quote
Bookmarks