PDA

View Full Version : Excel/VBA


Griffin 1
04-23-2002, 09:59 AM
Does anyone here know of a way to use VBA to detect which cells of an Excel spreadsheet has just part of the data struckout, and how to delete just the struckout part?

NoName
04-23-2002, 10:11 AM
Experimentation seems to show that if r is a range, then r.font.strikethrough is either false, true, or null (the last if some characters are struck through and some not).

Check out the Characters object in VBA to isolate individual characters.

Griffin 1
04-23-2002, 10:59 AM
I wasn't aware of the Characters object. I'll check it out. Thanks.

Gates Is Antichrist
04-24-2002, 11:21 AM
That looked interesting enough that I tried it too. Here's a shell in case it's useful.

Sub foo()
Dim c As Range, i As Integer
For Each c In ActiveSheet.UsedRange
For i = 1 To Len(CStr(c))
Debug.Print CStr(c), c.Characters(i, 1).Font.Strikethrough
Next i
Next c
End Sub