Cell Text Display Code macro does not update when cell contents are cleared

kholder_33

New Member
Joined
Oct 29, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,
This is my first post/question.
I am a novice beginner who has taught myself.
I have a code that does what I want it to do BUT......
When the macro is run the text box does not clear when cell contents are cleared.
I would also like for the macro to run automatically when any cell in the range C8:C82 is selected.
Can someone edit this code or come up with a new one or different method?
Thank you.
VBA Code:
Sub HoverCellShowContents_Text()
    Dim row_no As Integer
    For row_no = 8 To 83
         With Cells(row_no, 3)
                If ActiveSheet.Cells(row_no, 3).Value <> "" Then
                    .ClearComments
                    .AddComment
                    .Comment.Visible = False
                    .Comment.Text Text:=Cells(row_no, 3).Value
                    .Comment.Shape.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
                    .Comment.Shape.ScaleHeight 5, msoFalse, msoScaleFromTopLeft
                End If
            End With
        Next
End Sub
 
Last edited by a moderator:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hello all,
I've worked on this some more.
I am very SLOWLY trying to learn code but for now I have to find the majority of what I use already written by someone else.
I have tried something different to what I originally posted and I think you'll see that in the mini-sheet so no need to paste it here???
I have tried to include a sample of what I'm trying to do below in the mini-sheet.
Independently, the two codes in the Workbook do exactly what I want them to.
Here is what I am trying to accomplish.
Dropdown:
1. I would like to make multiple selections from the dropdown either all at once (which works) or the ability to build on the list at any time as I go back and forth between cells. Right now it starts over if I do that.
2. Ideally I would like to make multiple selections and the list not disappear (pick and scroll) but that's not a huge deal.
3. I would like for the list to not be able to add duplicates and remove a choice if I click on it a second time.
Comment Label:
1. Keep up with the ever changing contents of the cell (which right now it seems to be doing).

This may be asking a lot but I've tried for several days and I'm so low-level with all of this I need help.

I would also WELCOME any suggestions on a totally different approach to make all this function better.

Book1
I
15
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top