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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,215,201
Messages
6,123,621
Members
449,109
Latest member
Sebas8956

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