Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format some, not all, text in a comment
Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which
will display values from UserForm 1 TextBox2 and TextBox3. In between these two values in the comment, I have placed a " v " (to indicate one party against the other). I would like to format this "v" to bold and red. As both TextBox Values are unknown lengths, how can I achieve this? Many thanks -- Traa Dy Liooar Jock |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format some, not all, text in a comment
Try the below..
Sub Macro1() Dim objCom As Comment, strText1 As String, strText2 As String strText1 = "Man" strText2 = "Animal" Set objCom = Range("A1").AddComment(strText1 & " v " & strText2) With objCom.Shape.TextFrame .Characters(Len(strText1) + 2, 1).Font.ColorIndex = 3 .Characters(Len(strText1) + 2, 1).Font.Bold = True End With End Sub -- Jacob "Jock" wrote: Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which will display values from UserForm 1 TextBox2 and TextBox3. In between these two values in the comment, I have placed a " v " (to indicate one party against the other). I would like to format this "v" to bold and red. As both TextBox Values are unknown lengths, how can I achieve this? Many thanks -- Traa Dy Liooar Jock |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format some, not all, text in a comment
Another way is to use Instr()
Dim objCom As Comment, strComment As String strComment = "Man v Animal" Set objCom = Target.Offset(, 1).AddComment(strComment) With objCom.Shape.TextFrame .Characters(InStr(1, objCom.Text, " v ", vbTextCompare), 3).Font.ColorIndex = 3 .Characters(InStr(1, objCom.Text, " v ", vbTextCompare), 3).Font.Bold = True End With -- Jacob "Jock" wrote: Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which will display values from UserForm 1 TextBox2 and TextBox3. In between these two values in the comment, I have placed a " v " (to indicate one party against the other). I would like to format this "v" to bold and red. As both TextBox Values are unknown lengths, how can I achieve this? Many thanks -- Traa Dy Liooar Jock |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
comment format | Excel Discussion (Misc queries) | |||
How can i set preliminary format for comment box? | Setting up and Configuration of Excel | |||
Decide comment format 'globally'? Restore format with ws_change? | Excel Discussion (Misc queries) | |||
group comment format on text | Excel Worksheet Functions | |||
FORMAT COMMENT TEXT WITH MACRO | Excel Programming |