Link to home
Start Free TrialLog in
Avatar of LUIS FREUND
LUIS FREUND

asked on

USERFORM TO ADD COMMENTS IN EXCEL DISAPPEARS

I CREATED A USERFORM  IN EXCEL TO ADD COMMENTS BUT WHEN I CLOSE IT THE COMMENTS DISAPPEAR.  IS THERE A WAY TO RETAIN THE COMMENTS I ADDED
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Where are you adding the comments? In a cell?
Avatar of LUIS FREUND
LUIS FREUND

ASKER

To a cell I suppose.  I'm guessing it needs a place to be stored right?
How do you plan to use these comments?
Just for reference.  For each excel sheet I wanted a userform to add comments.
Here is code you can use to add a comment to a cell.

Dim strComment As String

    If Range("A1").Comment Is Nothing Then
        strComment = InputBox("Please enter the text of your comment", "Add Comment")
        If StrPtr(strComment) = 0 Or strComment = "" Then
            ' User pressed Escape or left comment blank
            Exit Sub
        End If
        Range("A1").AddComment strComment
    End If

Open in new window

Do I add this to a command button?
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is great...thank you.  Can this be done on a userform?   At times there will be a lot of information being entered.
Can what be done on a userform? Do you mean store the comment in the userform itself? If so the answer is no.
I was afraid of that......That was my goal.  I do appreciate your help!
Thank you!
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2016