andyreinlo
New Member
- Joined
- Sep 12, 2023
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
Hello,
I have a situation where I would like underlined text to be used in an IF logical test. I realise using the normal font formatting isnt ideal but i would like to get this working for my situation. From reading other posts, it seems I will need to use VBA to add a module. Adapting from another thread I have this...
Public Function IsUnderline(c As Range) As Boolean
On Error GoTo Handler
IsUnderline = c.Font.Underline
Exit Function
Handler:
If Err.Number = 94 Then IsUnderline = True
End Function
As a test, my formula currently is
=IF(ISUNDERLINE(D3),0,"")
The issue is it seems to display 0 in the cell regardless of the text is underlined or not. Can anyone please advise? I have never really used VBA before so it may be something obvious but not to me!
Thank you.
I have a situation where I would like underlined text to be used in an IF logical test. I realise using the normal font formatting isnt ideal but i would like to get this working for my situation. From reading other posts, it seems I will need to use VBA to add a module. Adapting from another thread I have this...
Public Function IsUnderline(c As Range) As Boolean
On Error GoTo Handler
IsUnderline = c.Font.Underline
Exit Function
Handler:
If Err.Number = 94 Then IsUnderline = True
End Function
As a test, my formula currently is
=IF(ISUNDERLINE(D3),0,"")
The issue is it seems to display 0 in the cell regardless of the text is underlined or not. Can anyone please advise? I have never really used VBA before so it may be something obvious but not to me!
Thank you.