If Function, looking for formats in values

M

ManBoy86

How would I write an IF function to check to see if a cell is in Italics and
if it is make another cell = 0


IF(A1???, B1=0) Anyone know what to put where the ?s are?

Thanks.
 
G

Gary''s Student

Try this small macro:

Sub routine()
If Range("A1").Font.FontStyle = "Italic" Then
Range("B1").Value = 0
End If
End Sub
 
J

Jovan Timotijevic

Or try this:

Function IsItalic(mCell As Range) As Boolean
IsItalic = mCell.Font.Italic
End Function

And then type in B1:

=IF(IsItalic(A1),0,"Not italic in A1")
 
Top