Excel Userform Comment Log

TessieBear99

New Member
Joined
Aug 26, 2018
Messages
20
Office Version
  1. 365
Platform
  1. Windows
I'd like to create a Userform which can be a log/tracker for comments.

I'm working on a spreadsheet with many rows of data and at the end of each row the plan is to have a button to view/add comments for that row. I'd like it to open up a Userform similar to the picture below (please note this is not my screenshot, it has been copied from this question: VBA code for a comment tracker on a userform):
Picture.JPG


As shown above, I'd like it to have (if possible) the name of the user with a date & time stamp, followed by the previously entered comments.
What isn't shown above which I'd like to have is an "Add comment" button which would bring up a box for the user to write their comment in then submit, and come back to this original Userform which would refresh to include the new comment.

The other thing is that it's a growing and changing worksheet and there are 109 rows of data in my table at the moment, and I will need to have this functionality applied to each row and all new rows going forward.

Is this even possible, and if it is, does someone have any idea how I could do this?

Thanks!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi @TessieBear99 . Thanks for posting on MrExcel board.

These are my suggestions:
at the end of each row the plan is to have a button to view/add comments for that row
1. If your idea is to have a button on each line, I do not recommend it since it is a very laborious task.​
I suggest you simply select the row where you want to update the comment and open the userform.​

2. The next recommendation is the controls in your userform:​
a) A TextBox1 on the form to capture the new comment​
b) TextBox2 to display all comments.​
c) Of course, a button to add the new comment.​
d) A button to save the comment.​
e) A button to cancel.​
As shown in the screenshot below:​
1685028896958.png

3) In both textbox change the MultiLine property to True​

1685028983891.png

4) We need to store the history of the comments on that line in a column.​
In my tests I put the column "M". Change to the letter of the column where you are going to save the comments in this line of the macro.​
VBA Code:
Const col As String = "M"

5) Copy the entire macro into your userform:​

VBA Code:
Option Explicit

Const col As String = "M"

Private Sub CommandButton1_Click()
  Dim cmt As String
  If TextBox1.Value = "" Then
    MsgBox "Enter comment"
    TextBox1.SetFocus
    Exit Sub
  End If
  cmt = Environ$("username") & " " & Format(Now, "dddd, dd mmm yyyy hh:mm am/pm") & Chr(10) & TextBox1.Value
  With TextBox2
    If .Value = "" Then .Value = cmt Else .Value = .Value & Chr(10) & Chr(10) & cmt
  End With
End Sub

Private Sub CommandButton2_Click()
  Range(col & ActiveCell.Row).Value = TextBox2.Value
  Unload Me
End Sub

Private Sub CommandButton3_Click()
  Unload Me
End Sub

Private Sub UserForm_Activate()
  TextBox2.Value = Range(col & ActiveCell.Row).Value
End Sub

--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------​
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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