ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toggle text to be visible and not visible (https://www.excelbanter.com/excel-programming/287441-toggle-text-visible-not-visible.html)

Dave Y[_3_]

Toggle text to be visible and not visible
 
I sent in a post a couple of days ago and did receive
some
replies that I am grateful for; but I am still stuck. I
don't have much experience with VBA and I need help. I
have a report that gets presented quartley. There is a
column on the spreadsheet that contains 2 types of
comments. One type of comments are for myself to keep
track of things. The other comments are meant for the
Board members to see when the report is presented. What I
want to do is have two buttons on the spreadsheet; one
button to remove all the comments that the board does not
want to see. The only comment the board wants to see are
the words "Special Mention". The other button is to
restore all of my comments that I need for myself while
I'm working on the report. In other words when I click on
a button named (let's say)Special Mention, all text in
the
column should go away except for the words "Special
Mention. So far I have been able to either make all the
text either be visible or not with the following code:

Private Sub cmdViewComments_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(0, 0, 0)

End Sub

Private Sub cmdSpecialMention_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(255, 255, 255)
End Sub

I need help with the code to enable me to only display
the
words/text "Special Mention" in the Comments column. I
know this is a long post and I appreciate the patience in
reading it. Thank you for any help provoided. Dave
PS This is the second time I'm posting the exact same
post; it never appeared the first time.


Cliff Myers

Toggle text to be visible and not visible
 
Try this, add this code to your buttons click event. This will change all
the cells in the range that have the words "Special Mention" in them to
white. Just change the color number to whatever color you want for your
sheet. For your other button just add the same code except change the equal
to sign to < and then change the color number to your desired color.
For Each cell In Range("B4:b20")
If cell.Value = "Special Mention" Then
cell.Font.ColorIndex = 2

End If
Next cell
HTH

"Dave Y" wrote in message
...
I sent in a post a couple of days ago and did receive
some
replies that I am grateful for; but I am still stuck. I
don't have much experience with VBA and I need help. I
have a report that gets presented quartley. There is a
column on the spreadsheet that contains 2 types of
comments. One type of comments are for myself to keep
track of things. The other comments are meant for the
Board members to see when the report is presented. What I
want to do is have two buttons on the spreadsheet; one
button to remove all the comments that the board does not
want to see. The only comment the board wants to see are
the words "Special Mention". The other button is to
restore all of my comments that I need for myself while
I'm working on the report. In other words when I click on
a button named (let's say)Special Mention, all text in
the
column should go away except for the words "Special
Mention. So far I have been able to either make all the
text either be visible or not with the following code:

Private Sub cmdViewComments_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(0, 0, 0)

End Sub

Private Sub cmdSpecialMention_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(255, 255, 255)
End Sub

I need help with the code to enable me to only display
the
words/text "Special Mention" in the Comments column. I
know this is a long post and I appreciate the patience in
reading it. Thank you for any help provoided. Dave
PS This is the second time I'm posting the exact same
post; it never appeared the first time.




Dave Y[_3_]

Toggle text to be visible and not visible
 
Hey Cliff
Your code did the trick; it performed exactly what I need to do. Thank you very much for your reply and your help
Have a great day
Dave Y

Dave Peterson[_3_]

Toggle text to be visible and not visible
 
See your other post for a non-macro suggestion.

Dave Y wrote:

I sent in a post a couple of days ago and did receive
some
replies that I am grateful for; but I am still stuck. I
don't have much experience with VBA and I need help. I
have a report that gets presented quartley. There is a
column on the spreadsheet that contains 2 types of
comments. One type of comments are for myself to keep
track of things. The other comments are meant for the
Board members to see when the report is presented. What I
want to do is have two buttons on the spreadsheet; one
button to remove all the comments that the board does not
want to see. The only comment the board wants to see are
the words "Special Mention". The other button is to
restore all of my comments that I need for myself while
I'm working on the report. In other words when I click on
a button named (let's say)Special Mention, all text in
the
column should go away except for the words "Special
Mention. So far I have been able to either make all the
text either be visible or not with the following code:

Private Sub cmdViewComments_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(0, 0, 0)

End Sub

Private Sub cmdSpecialMention_Click()
Worksheets("Sheet1").Range("Comments").Font.Color
= RGB(255, 255, 255)
End Sub

I need help with the code to enable me to only display
the
words/text "Special Mention" in the Comments column. I
know this is a long post and I appreciate the patience in
reading it. Thank you for any help provoided. Dave
PS This is the second time I'm posting the exact same
post; it never appeared the first time.


--

Dave Peterson



All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com