Re: Solved It
Great, more of a sense of achievement that way!
... took alot more code than i thought it would.
Having a bit of extra code is not a problem if it does what you want and without undue slowness, and I think your code does that. However, it could be shortened a bit (just in the written amount of code, not the processing steps/time) by the sort of looping I was suggesting earlier.
A couple of other comments:
1. Your
With Selection
.
.
End With
does nothing as far as I can see, so I have removed it.
2. I'm also wondering about:
With Cells(Selection.Row, Selection.Column)
If you just have a single cell selected, the comment will be added to that cell. However, if you have a range selected the comment will be added to the top left cell in the selection, even if that cell is not the active cell. For example if you click in H20 and drag up and left to G10, your active cell is still H20, but the code will put the comment in H10. Is that what you intended?
Anyway, here's a slighly amended code for you to consider:
<font face=Courier New><SPAN style="color:#00007F">Dim</SPAN> UserN <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> commt <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> myBolds<br><SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br><br>UserN = Application.UserName<br>myBolds = Array(UserN, "Start:", "End:", "Where:")<br>commt = UserN & Chr(10) & Chr(10) _<br> & "Start: " & StartC & " - " & StartT & Chr(10) _<br> & "End: " & <SPAN style="color:#00007F">End</SPAN>C & " - " & <SPAN style="color:#00007F">End</SPAN>T & Chr(10) _<br> & "Where: " & WhereT<br><SPAN style="color:#00007F">With</SPAN> Cells(Selection.Row, Selection.Column)<br> .ClearComments<br> .AddComment<br> .Comment.Visible = <SPAN style="color:#00007F">False</SPAN><br> .Comment.Shape.AutoShapeType = msoShapeRoundedRectangle<br> .Comment.Text Text:=commt<br> <SPAN style="color:#00007F">With</SPAN> .Comment.Shape.TextFrame<br> <SPAN style="color:#00007F">For</SPAN> i = 0 <SPAN style="color:#00007F">To</SPAN> <SPAN style="color:#00007F">UBound</SPAN>(myBolds)<br> <SPAN style="color:#00007F">With</SPAN> .Characters(InStr(1, commt, myBolds(i)), Len(myBolds(i))).Font<br> .Bold = <SPAN style="color:#00007F">True</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br> <SPAN style="color:#00007F">Next</SPAN> i<br> .Characters.Font.Size = 12<br> End <SPAN style="color:#00007F">With</SPAN><br> .Comment.Shape.TextFrame.AutoSize = <SPAN style="color:#00007F">True</SPAN><br>End <SPAN style="color:#00007F">With</SPAN></FONT>