Using this simple code to conditionally format cell if "X" is true, can someone share what the most simplistic way is ~ to accomplish this whether it be with NUMERIC or TEXT methods?
IF NEEDING TO CONDITIONALLY FORMAT NUMER:
(THIS CODE WORKS GREAT BUT IS THERE A SHORTER MORE SIMPLISTIC WAY?)
IF NEEDING TO CONDITIONALLY FORMAT TEXT:
(THIS CODE DOES NOT WORK AND IS THERE A SHORTER MORE SIMPLISTIC WAY?)
>>>> Even better, is there a way to write the code in a 'universal way' to accept on the fly changes whether it be NUMERIC or TEXT?
For example, if I'm needing to use a chunk of this code today to locate the number "275" in Column J
and tomorrow I'd like to quickly change the "275" to the letter "Y" to seach cells with the "Y" code in Column R, without having to rewrite code to accept NON-NUMERIC...
IF NEEDING TO CONDITIONALLY FORMAT NUMER:
(THIS CODE WORKS GREAT BUT IS THERE A SHORTER MORE SIMPLISTIC WAY?)
Code:
Sub ColorNmbrIf()
Set test = Range("j2:j50")
For Each cell In test
If IsNumeric(cell.Value) = False Then
cell.Interior.ColorIndex = x1None 'no color
ElseIf cell.Value = "275" Then
cell.Interior.ColorIndex = 3 'red
Else
cell.Interior.ColorIndex = xlNone
End If
Next
End Sub
IF NEEDING TO CONDITIONALLY FORMAT TEXT:
(THIS CODE DOES NOT WORK AND IS THERE A SHORTER MORE SIMPLISTIC WAY?)
Code:
Sub ColorNmbrIf()
Set test = Range("j2:j50")
For Each cell In test
If IsNumeric(cell.Value) = False Then
cell.Interior.ColorIndex = x1None 'no color
ElseIf cell.Value = "Y" Then
cell.Interior.ColorIndex = 3 'red
Else
cell.Interior.ColorIndex = xlNone
End If
Next
End Sub
>>>> Even better, is there a way to write the code in a 'universal way' to accept on the fly changes whether it be NUMERIC or TEXT?
For example, if I'm needing to use a chunk of this code today to locate the number "275" in Column J
and tomorrow I'd like to quickly change the "275" to the letter "Y" to seach cells with the "Y" code in Column R, without having to rewrite code to accept NON-NUMERIC...