Hide Some Text in a Cell

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
 
G

Gord Dibben

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
 
G

Gord Dibben

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
 

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