Hide Some Text in a Cell

  • Thread starter Thread starter DOUG
  • Start date Start date
D

DOUG

Is there a way to hide certain text temporarily in a cell while displaying
the rest of the cell's contents? I know I could color that text white, but
it repeats in many cells in the same column. I want to hide the same
repetitive words in all of the adjoing cells, then uncover them later.

DOUG ECKERT
 
1) It can be DELETED with a Macro [and "pasted" back later.
2) You can use =SUBSTITUTE(A1,"ABC","") in cell B1' in order to hide the ABC
copying the formula down the range and, Temporarily, Hide column A.
Afterwards, you can Hide Column B and uh-hide column A
Micky
 
Sub Color_String()
Dim Rng As Range
Dim Cell As Range
Dim start_str As Integer
Set Rng = Selection
For Each Cell In Rng
start_str = InStr(Cell.Value, "certain text")
If start_str Then
Cell.Characters(start_str, 5).Font.ColorIndex = 2
End If
Next
End Sub


Gord Dibben MS Excel MVP
 
If I'm not mistaken - instead of 5 it should read LEN("certain text")
Micky
 
Thanks Micky

Changed part of old macro and forgot to change other parts to match.

Could do better than hard coding the string.

Sub Color_String()
Dim Rng As Range
Dim Cell As Range
Dim start_str As Integer
Dim mystr As String
mystr = InputBox("Enter a text string")
Set Rng = Selection
For Each Cell In Rng
start_str = InStr(Cell.Value, mystr)
If start_str Then
Cell.Characters(start_str, Len(mystr)).Font.ColorIndex = 2
End If
Next
End Sub


Gord
 
Back
Top