Partial Strikethrough in Excel

shant Youkhana

New Member
Joined
Sep 19, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a data set where I want to redline (strikethrough with red font) specific word within the cell. For example I want to strikethrough, in red fond, the word "Car" and the word "house" from all the cell in the data set. I really dont know how to code any Macros, any help would be appreciated.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Maybe something like this. Just select the cell and run code. Select B2 in this case
New Microsoft Excel Worksheet.xlsx
ABCD
1
2I have a car in my house
3
4
5
Sheet1


The macro
VBA Code:
Option Compare Text

Sub ColorStrike()

Dim wd1 As String, wd2 As String
Dim cell As Range

Set cell = ActiveCell
wd1 = "house"
wd2 = "car"

With cell.Characters(Start:=InStr(cell, wd1), Length:=Len(wd1)).Font
    .ColorIndex = 3
    .Strikethrough = True
End With

With cell.Characters(Start:=InStr(cell, wd2), Length:=Len(wd2)).Font
    .ColorIndex = 3
    .Strikethrough = True
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top