How do I bold a word or date in a formula

Anonymous
2011-08-29T21:32:10+00:00

Hi,

I need to bold a word in a paragraph in excel.  There is a reference to the cell in the paragraph but it is not formatting the information the same as the cell when it goes into the paragraph.

Examples below.

This Order Form is valid only for projects for <<Name of client using software>>(hereafter referred to as “Authorized User”). This Order Form is subject to all the terms and conditions of the Client Service Agreement dated <<Date form is signed>>(the “Agreement”) and Agreement to Purchase (the “ATP”) by and between Mr. Client.,  (“Client”) and Provider, Inc. (“Provider”).

The information for <<Name of client using software>> is in Cell B4 and the information for <<Date form is signed>> is in cell B5.

The formula is as follows:

="This Order Form is valid only for projects for "&B4& "(hereafter referred to as “Authorized User”). This Order Form is subject to all the terms and conditions of the Client Service Agreement dated "&TEXT(B5,"mm-dd-yyyy")& "(the “Agreement”) and Agreement to Purchase (the “ATP”) by and between Benefit Controls, Inc.,  (“Client”) and Benefitfocus.com, Inc. (“Benefitfocus”)."

I know that when you merge Excel information into Word you can set the formatting up in the merge field "directions".

Is there some type of "wording" that can be entered into the formula for this information to be bold (B4 & B5).  They are bold in their actual cells but it does not "follow" the information into the paragraph.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2011-08-30T18:30:43+00:00

Somewhere along the way, the left and right quotation marks around "Authorized User" got changed to ordinary quotation marks.

I had initially copied from your post and was using:  “Authorized User”

However, in the line you posted, you are using:  "Authorized User"

Since VBA uses the ordinary quote marks to indicate a string, you are getting the syntax error.

You can either double up on the quotes, or use the separate left and right quotes as I did.

So, either:

  Const sPart2 As String = " (hereafter referred to as ""Authorized User""). This Order Form is subject to all the terms and conditions of the Client Service Agreement dated "

or

  Const sPart2 As String = " (hereafter referred to as “Authorized User”). This Order Form is subject to all the terms and conditions of the Client Service Agreement dated "

Was this answer helpful?

0 comments No comments
Answer accepted by question author
Anonymous
2011-08-30T02:49:37+00:00

You can only BOLD portions of text where the entire cell contains only a text string.

A VBA Macro could be written to produce the text string and bold the relevant portions.

Here's one way to do that.  It will put the results in A1, but you can see how to change that easily.

To enter this Macro (Sub), <alt-F11> opens the Visual Basic Editor.

Ensure your project is highlighted in the Project Explorer window.

Then, from the top menu, select Insert/Module and

paste the code below into the window that opens.

To use this Macro (Sub), <alt-F8> opens the macro dialog box. Select the macro by name, and <RUN>.

==================================

Option Explicit

Sub BoldUserDate()

Dim res As Range

    Const sPart1 As String = "This Order Form is valid only for projects for "

    Const sPart2 As String = " (hereafter referred to as “Authorized User”). This Order Form is subject to all the terms and conditions of the Client Service Agreement dated "

    Const sPart3 As String = " (the “Agreement”) and Agreement to Purchase (the “ATP”) by and between Benefit Controls, Inc.,  (“Client”) and Benefitfocus.com, Inc. (“Benefitfocus”)."

    Dim lenPart1 As Long, lenPart2 As Long

    Dim AuthorizedUser As String

    Dim DateFormSigned As String

    Dim lenAuthorizedUser As Long, lenDateFormSigned As Long

lenPart1 = Len(sPart1)

lenPart2 = Len(sPart2)

AuthorizedUser = Range("B4").Text

DateFormSigned = Format(Range("B5"), "mm-dd-yyyy")

lenAuthorizedUser = Len(AuthorizedUser)

lenDateFormSigned = Len(DateFormSigned)

'Write Result

Set res = Range("A1")

Application.ScreenUpdating = False

res.Value = sPart1 & AuthorizedUser & sPart2 & DateFormSigned & sPart3

With res

    .Characters(lenPart1 + 1, lenAuthorizedUser).Font.Bold = True

    .Characters(lenPart1 + lenAuthorizedUser + lenPart2 + 1, lenDateFormSigned).Font.Bold = True

End With

Application.ScreenUpdating = True

End Sub

================================

If you would prefer to have this update automatically, whenever you change B4 or B5, you can use an event-triggered macro in addition.

To enter this event-triggered Macro, right click on the sheet tab.

Select "View Code" from the right-click drop-down menu.

Then paste the code below into the window that opens.

===================================

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("B4:B5")) Is Nothing Then

    Application.EnableEvents = False

        BoldUserDate

    Application.EnableEvents = True

End If

End Sub

================================

Was this answer helpful?

0 comments No comments

10 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-09-15T11:30:07+00:00

    You kind sir are an absolute genius!  Thanks.

    Was this answer helpful?

    0 comments No comments
  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Anonymous
    2011-09-14T21:39:35+00:00

    How do I do that?

    Was this answer helpful?

    0 comments No comments