Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    String code to bold face lines (Excel xp)

    I need to make all the cells in COL A that end in the words (subway) into bold face. For instance, 57th and 99th (subway) is in A49 so it needs to be bold and First Central (subway) is in A100 and it needs to be bold but not any of the other cells in COL A. Thank you for your help.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String code to bold face lines (Excel xp)

    1- Select Column A.

    2- From the Format Menu select Conditional formatting...

    3- In the drop down list select Formula is. Enter this formula into the formula box:

    <pre>=RIGHT(A9,8)="(subway)"
    </pre>


    4- Click on the Format button.

    5- Click on the Font tab.

    6- Click on Bold.

    7- Click on OK to close all dialog boxes.
    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String code to bold face lines (Excel xp)

    It can be done using conditional formatting, the only problem being that each cell needs a different for formula in the conditional formatting, i.e. in cell A1 you need A1 in the formula, in A2 you need A2, and so on.
    I'm not sure if you are familiar with VBA or not, but selecting the area you want and then running the following procedure will do it for you
    <pre>Sub MakeBold()
    Dim rg As Range: For Each rg In Selection.Cells
    If Right(rg.Value, 8) = "(subway)" Then rg.Font.Bold = True
    Next rg
    End Sub</pre>


  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: String code to bold face lines (Excel xp)

    If you select the entire region, and use A1 in the formula, Conditional formatting uses RELATIVE REFERENCES and will use A2 in row2, A3 in row3, etc

    Steve

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String code to bold face lines (Excel xp)

    I gave that a try first, but I had the bottom cell as the active cell in the selected range, so it didn't work. You are right though, it will use relative references, but only if you have A1 as the active cell, so the VBA I posted is not needed.

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: String code to bold face lines (Excel xp)

    It will also work if you have the bottom cell as the active cell. You just have to use that cell's address in the formula and the relative addressing will do the rest.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •