Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Need Excel Formula Help! I would like a formula that will do the following: If a cell contains "Not Interested" I want it and...?
…all preceding cells in the row to highlight red and strike through the text. It seems like a combo of IF statement and conditional formatting is what I need, but nothing I've tried works. Any help would be appreciated!
Thanks,
Chris
1 Answer
- garbo7441Lv 75 years agoFavorite Answer
I doubt you can accomplish what you wish using IF formulas and conditional formatting. However, here is one way to emulate a formula to do as you wish.
Copy the following VBA event handler to the clipboard (highlight the entire event handler, right click inside the highlighted area, and 'Copy'):
Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Count = 1 Then
If UCase(Target.Value) = "NOT INTERESTED" Then
aCol = Split(Cells(1, Target.Column).Address, "$")(1)
Columns(aCol & ":" & aCol).AutoFit
For i = 1 To Target.Column
Cells(Target.Row, i).Font.Strikethrough = True
Cells(Target.Row, i).Interior.ColorIndex = 3
Next
ElseIf UCase(Target.Value) <> "NOT INTERESTED" Then
For i = 1 To Target.Column
Cells(Target.Row, i).Font.Strikethrough = False
Cells(Target.Row, i).Interior.ColorIndex = xlNone
Next
End If
End If
End Sub
Select the worksheet containing the data you wish to evaluate and right click the sheet tab at the bottom.
Select 'View Code'.
Paste the event handler into the white editing area to the right (right click inside the area and 'Paste').
Close the VBE (red button - top right)
Select any cell and enter: NOT INTERESTED, not interested, or Not Interested and TAB, ENTER, or click another cell. All cells to the left of the cell containing the key words, and the cell containing the text, will fill red and strikethrough the text. If you then delete the key words, the red fill and strikethrough will be removed from all cells in the row.