Toggle Text in a column to be visible or not visible
another solution by change of format:
Sub Reset(cell As Range, Optional bShow As Boolean = True)
If bShow Then
cell.NumberFormat = "General"
Else
cell.NumberFormat = ";;;"
End If
End Sub
MP
"Patrick Molloy" a écrit dans le message de
...
set the text's COLOR to the same as the cell's background
color. This will make the writing seem to disappear.
the following test should be stepped through using
shift+F8
The first test line will make the text vanish & th
esecong will make it appear. First select some cells with
text . try changing the cells color.
Sub test()
Reset Selection, False
Reset Selection, True
End Sub
Sub Reset(cell As Range, Optional bShow As Boolean = True)
Dim clr As Long
With cell
If bShow Then
.Font.ColorIndex = 0
Else
clr = .Interior.ColorIndex
If .Interior.ColorIndex < 0 Then
clr = 2
End If
.Font.ColorIndex = clr
End If
End With
End Sub
Patrick Molloy
Microsoft Excel MVP
-----O
riginal Message-----
I have a report in an Excel 2002 spreadsheet that is
presented quartely. There is a column that contains
comments that I need for my own use but when the report
is presented to the Board only the comment of "Special
Mention" needs to be shown. My question is; How can I
make the text in the column containing the comments that
I don't want visible to be not visible? (the only
comment
showing would be "special mention") Also I need some way
to be able to toggle back and forth between making the
text visible and not visible. I was thinking of using
two
buttons, each containing the code that would serve my
purpose, but I am unsure of how to do this. Any help
with
a solution or pointing me in the proper direction will
be
greatly appreciated. Thank you.
Dave
.
|