Jan 18 2023 09:47 AM
Jan 18 2023 09:47 AM
Hello
I would like to use (conditional?) formatting so that if, for example, I have a number that is above 0, I can format to say yes and be green and if it is below 0 be red and say no. I know how to use conditional formatting so that the colour of the cell changes, but does anyone know how to make it say yes or no as well?
Thanks !
Jan 18 2023 10:14 AM
@Deleted
Sub format()
Dim i, j As Long
Dim l As String
Range("A:Z").Interior.ColorIndex = 0
For i = 1 To 10
For j = 1 To 7
If Cells(i, j).Value > 0 Then
Cells(i, j).Interior.ColorIndex = 4
l = Cells(i, j).Value
Cells(i, j).Value = l & " yes"
Else
If Cells(i, j).Value < 0 Then
Cells(i, j).Interior.ColorIndex = 3
l = Cells(i, j).Value
Cells(i, j).Value = l & " no"
Else
End If
End If
Next j
Next i
End Sub
Maybe with these lines of code. In the attached file you can click the button in cell J2 to run the macro.