PDA

View Full Version : Cell back color



amir0914
04-09-2020, 09:31 AM
Hi all, I wrote a small function to use in excel range, but it gives error to cell back color, Does someone know why actually it gives error in cell ??



Function pp(tx As Range)
If tx > 1 Then
pp = 103
tx.Interior.Color = vbRed
End If
End Function

26314

YasserKhalil
04-09-2020, 10:24 AM
You can't change the interior color through using UDF. Try using normal sub instead.

Paul_Hossler
04-09-2020, 05:15 PM
Or Conditional Formatting

amir0914
04-10-2020, 12:36 AM
Thank you, I did it so easily with Conditional formatting.