Answered by:
VBA Excel to determine if a partial strikethrough of text in a cell is true
Question

VBA Excel to determine if a partial strikethrough of text in a cell is true
I can see how
Range.Font.Strikethrough = True
could help if the whole range was marked as a strikethrough, but I want to know if the below condition is true with VBA; so only part of the text has the strikethrough effect and when is this true. I did try text to columns, but the formatting does not carry to the other columns.
fdas is the oneThank you
 Edited by FirmsAFTM Wednesday, March 7, 2018 3:19 PM
Answers

Here is a function you can use:
Function HasStrikethrough(rng As Range) As Boolean Dim i As Long With rng(1) For i = 1 To .Characters.Count If .Characters(i, 1).Font.Strikethrough Then HasStrikethrough = True Exit For End If Next i End With End Function
The function is to be used for a single cell; if you supply a multicell range as argument, it looks at the first cell of that range.
Usage:
If HasStrikethrough(Range("B37")) Then
...
End IfRegards, Hans Vogelaar (http://www.eileenslounge.com)
 Marked as answer by FirmsAFTM Wednesday, March 7, 2018 4:42 PM
All replies

Here is a function you can use:
Function HasStrikethrough(rng As Range) As Boolean Dim i As Long With rng(1) For i = 1 To .Characters.Count If .Characters(i, 1).Font.Strikethrough Then HasStrikethrough = True Exit For End If Next i End With End Function
The function is to be used for a single cell; if you supply a multicell range as argument, it looks at the first cell of that range.
Usage:
If HasStrikethrough(Range("B37")) Then
...
End IfRegards, Hans Vogelaar (http://www.eileenslounge.com)
 Marked as answer by FirmsAFTM Wednesday, March 7, 2018 4:42 PM
