From what I can tell the only code I can use to add a string as a Cell's Note Text is Range.NoteText. Is there a way to make part of that NoteText bold? I have the strings saved as values in a Userform and as a public variable.
It is these two lines:
Cells(LR, 5).NoteText txtFld6.Value & ": " & modForms.Note1
Cells(LR, 6).NoteText txtFld6.Value & ": " & modForms.Note2
I'd like the txtFld6.Value & ": " portion to be bold since it has the employee ID of the person filling out the form.
This is the full code for that Sub. From what I can tell there are more options for comments so maybe that should be my focus instead, but I just wanted to keep the way it populates as similar as possible to what we are currently doing by hand.
'Submit button Subs
Private Sub cmbSubmit_Click()
Dim LR As Integer
Set modForms.ws = ActiveWorkbook.Worksheets.Item(modForms.Assay)
modForms.ws.Activate
LR = ActiveSheet.UsedRange.Rows.Count
If Cells(LR, 1).Value <> "" Then
ActiveSheet.ListObjects(modForms.Assay).ListRows.Add
End If
LR = ActiveSheet.UsedRange.Rows.Count
Cells(LR, 1).Value = txtRun.Value
Cells(LR, 2).Value = txtMonth.Value & "/" & txtDay.Value & "/" & txtYear.Value
Cells(LR, 3).Value = cbInstrument.Value
Cells(LR, 4).Value = txtSamples.Value
Cells(LR, 5).Value = cbCT.Value
Cells(LR, 5).NoteText txtFld6.Value & ": " & modForms.Note1
Cells(LR, 6).Value = cbNEGEC.Value
Cells(LR, 6).NoteText txtFld6.Value & ": " & modForms.Note2
Cells(LR, 7).Value = txtFld1.Value
Cells(LR, 8).Value = txtFld2.Value
Cells(LR, 9).Value = txtFld3.Value
Cells(LR, 10).Value = txtFld4.Value
Cells(LR, 11).Value = txtFld5.Value
Cells(LR, 12).Value = txtFld6.Value
Cells(LR, 13).Value = txtFld7.Value
Cells(LR, 14).Value = txtFld8.Value
Unload Me
End Sub
Please try.
Dim iLen As Long
Cells(LR, 5).NoteText txtFld6.Value & ": " & modForms.Note1
iLen = Len(txtFld6.Value) + 1
Cells(LR, 5).Comment.Shape.TextFrame.Characters(1, iLen).Font.Bold = True
Microsoft documentation: