Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "J").End(xlUp).Row
For i = 1 To Lastrow
If Cells(i, "J").Interior.Color = vbRed Then Cells(i, "J").Value = "ENTER"
Next
Isn't your logic flipped? Shouldn't you check if the cell contains "Enter" and then highlight red?Hey Joe4,
I do appreciate that and due to the nature of the sheet could you kindly show me the vba method?
I'm experimenting with the following:
VBA Code:Application.ScreenUpdating = False Dim i As Long Dim Lastrow As Long Lastrow = Cells(Rows.Count, "J").End(xlUp).Row For i = 1 To Lastrow If Cells(i, "J").Interior.Color = vbRed Then Cells(i, "J").Value = "ENTER" Next
Please let me know, if you can help!
R/
pinaceous
Option Explicit
Sub test()
Dim rng As Range, f, fCell As String
Set rng = ActiveSheet.UsedRange
Set f = rng.Find("ENTER", , xlValues, xlPart)
If Not f Is Nothing Then
f.Interior.Color = vbRed
fCell = f.Address
Do
Set f = rng.FindNext(f)
If Not f Is Nothing Then f.Interior.Color = vbRed
Loop Until f.Address = fCell
End If
End Sub
Sub HightlightENTER()
Dim xCll As Range
For Each xCll In Range("H11:AC180")
If InStr(xCll.Value, "ENTER") > 0 Then
xCll.Interior.Color = RGB(255, 0, 0)
Else
xCll.Interior.Pattern = xlNone
End If
Next xCll
End Sub
=ISNUMBER(FIND("ENTER KG!",H11))
You can set a cell to value that you can use it for turn on or off your hightlight condition. For example:eiloken,
Okay, thank you! This is very interesting now!
How would you turn on/off the
conditional formating?VBA Code:=ISNUMBER(FIND("ENTER KG!",H11))
For example, if I wanted to run this CF on opening up my document then turn it off after it has been completed?
Or would this situation call for the sub approach?
Thanks,
-pinaceous
Sub HightlightENTER()
Dim xCll As Range
Range("H11:AC180").Interior.Pattern = xlNone
If Range("A1").Value = "ON" Then
For Each xCll In Range("H11:AC180")
If InStr(xCll.Value, "ENTER") > 0 Then
xCll.Interior.Color = RGB(255, 0, 0)
End If
Next xCll
End If
End Sub