Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Clear Comment problem
hello,
I want to get the code below to stop inserting comment when I hit cancel. Any help? Thx. Sub vbutton() Dim strComments As String strComments = InputBox("Please Type your comment") ActiveCell.AddComment ActiveCell.Comment.Visible = False ActiveCell.Comment.Text Environ$("USERNAME") & Chr(10) & strComments If Cancel = True Then ActiveCell.ClearComments End If End Sub -- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Clear Comment problem
Sub vbutton()
Dim strComments As String strComments = InputBox("Please Type your comment","Enter Comment","") If Len(strComments) 0 Then ActiveCell.AddComment ActiveCell.Comment.Visible = False ActiveCell.Comment.Text Environ$("USERNAME") & Chr(10) & strComments If Cancel = True Then ActiveCell.ClearComments End If End If End Sub The revision to the InputBox statement makes an empty string the default, the new IF test will test content of strComment and if it is empty, will not add a comment to the cell. "saman110 via OfficeKB.com" wrote: hello, I want to get the code below to stop inserting comment when I hit cancel. Any help? Thx. Sub vbutton() Dim strComments As String strComments = InputBox("Please Type your comment") ActiveCell.AddComment ActiveCell.Comment.Visible = False ActiveCell.Comment.Text Environ$("USERNAME") & Chr(10) & strComments If Cancel = True Then ActiveCell.ClearComments End If End Sub -- Message posted via http://www.officekb.com |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Clear Comment problem
Thank you. works great.
JLatham wrote: Sub vbutton() Dim strComments As String strComments = InputBox("Please Type your comment","Enter Comment","") If Len(strComments) 0 Then ActiveCell.AddComment ActiveCell.Comment.Visible = False ActiveCell.Comment.Text Environ$("USERNAME") & Chr(10) & strComments If Cancel = True Then ActiveCell.ClearComments End If End If End Sub The revision to the InputBox statement makes an empty string the default, the new IF test will test content of strComment and if it is empty, will not add a comment to the cell. hello, [quoted text clipped - 14 lines] End If End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200708/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy comment content to cell content as data not as comment | Excel Discussion (Misc queries) | |||
How can I edit a comment w/o first having to select Show Comment | Excel Discussion (Misc queries) | |||
How do I insert a comment when the Insert:Comment menu is greyed? | Excel Discussion (Misc queries) | |||
Hotkey problem w/ macro to append comment | Excel Discussion (Misc queries) | |||
a comment plugin & copy paste directly from excel to comment ? fr. | Excel Worksheet Functions |