ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   InputBoxes (https://www.excelbanter.com/excel-programming/367711-inputboxes.html)

Sean

InputBoxes
 
Hi,

I've created a button to allow a user to add comments to a protected
sheet. I have this code below:

Sub Add_comment()
Dim comment As Variant
ActiveSheet.Unprotect Password:="55555"
comment = InputBox("Enter Date Here")
If comment = False Then Exit Sub
ActiveCell.NoteText comment
ActiveSheet.Protect Password:="55555"
End Sub

I would like to have two input boxes that populate one comment. I want
the user to be prompted to insert the date (or have the date
automatically pulled in) and have a second prompt that asks the user to
input the comment, so that there comment shows up with the date and
what they are saying.

Thank you,

Sean


Bearacade[_35_]

InputBoxes
 

Why not just datestamp it yourself?
Another thing to consider, if someone put a comment on the code an
then put another comment, it is going to overwrite the first comment,
the below code will make it so the it adhere to existing comments.

If you don't want that feature, just change the Temp = line to Temp
Date & " - " & comment

Sub Add_comment()

Dim comment As Variant
Dim Temp As Variant

ActiveSheet.Unprotect Password:="55555"

comment = InputBox("Enter Comment")
If comment = "" Then Exit Sub

Temp = ActiveCell.NoteText & Date & " - " & comment

ActiveCell.NoteText Temp

ActiveSheet.Protect Password:="55555"

End Su

--
Bearacad

-----------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...fo&userid=3501
View this thread: http://www.excelforum.com/showthread.php?threadid=56294


Sean

InputBoxes
 
Awesome! Never thought about that.

Thank you!!

Sean



All times are GMT +1. The time now is 04:18 PM.

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