How to format with a strikethrough like something's been crossed out

  • Thread starter gimme_this_gimme_that
  • Start date
G

gimme_this_gimme_that

I'd like to write text in a cell and have a line go through the middle
showing that it's been "crossed out".

How do I do that?

Thanks.
 
M

merjet

Range("A1").FormulaR1C1 = "text"
Range("A1").Font.Strikethrough = True

Hth,
merjet
 
G

Guest

To do that in A1,

Range("A1").Value = "Cross this out"
Range("A1").Font.Strikethrough = True
 
G

Gord Dibben

Private Sub Worksheet_Change(ByVal Target As Range)
'Strikethrough ignore spaces
Dim v As Variant, i As Integer
If Not Intersect(Target, Columns("A")) Is Nothing Then
If Target(1, 1).HasFormula = False Then
v = Target(1, 1).Value
Application.EnableEvents = False
For i = 1 To Len(v)
If Not (Mid(v, i, 1)) = Chr(32) Then
Target(1, 1).Characters(Start:=i, _
Length:=1).Font.Strikethrough = True
End If
Next i
Application.EnableEvents = True
End If
End If
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top