+ Reply to Thread
Results 1 to 11 of 11

Automatically bold certain phrases within a cell

  1. #1
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Automatically bold certain phrases within a cell

    Hi all

    I am an Excel novice and have so far learnt to make the attached spreadsheet. It is for automatically calculating reagents I need in my chemistry experiments, so I have three worksheets: a 'database' of reagents, the calculator itself, and a summary page (which I will eventually format so I can print it).

    In the 'Summary' worksheet I want to highlight certain phrases in bold automatically - and from a quick internet search I think I will need to use a macro. I have found some suggestions online but cannot get any to work.

    In cell C24 I have some phrases, such as 'R1-Explosive when dry' and 'R2-Risk of explosion by shock, friction, fire or other source of ignition', and would like to know how to bold these phrases individually as and when the cell is populated with a list of phrases.

    I would like certain phrases to be bold, and not others, as I would like to only highlight the more dangerous phrases.

    Anyone have any ideas how to solve this problem?

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Automatically bold certain phrases within a cell

    I would like certain phrases to be bold, and not others, as I would like to only highlight the more dangerous phrases.
    All these parameters need to be identified. We only know what you tell us. The code is the same way.

    how to bold these phrases individually as and when the cell is populated with a list of phrases.
    What? Bold which cells. Just C24? Other cells in the summary sheet. Some clarification is needed.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Re: Automatically bold certain phrases within a cell

    Quote Originally Posted by stnkynts View Post
    All these parameters need to be identified. We only know what you tell us. The code is the same way.



    What? Bold which cells. Just C24? Other cells in the summary sheet. Some clarification is needed.
    To clarify the above:

    For now it doesn't necessarily matter what phrases I want to be bolded or not, as I am able (hopefully) to take help given and adapt it myself to include the phrases I need bolded.

    I will be generating lists of phrases as now shown in the updated spreadtsheet, such as "--R1-Explosive when dry--R2-Risk of explosion by shock, friction, fire or other source of ignition--R3-Extreme risk of explosion by shock, friction, fire or other source of ignition--R4-Forms very sensitive explosive metallic compounds--R5-Heating may cause an explosion--R6-Explosive with or without contact with air"

    For example I only want "R1-Explosive when dry" and "R6-Explosive with or without contact with air" to be in bold, but the others just normal.

    If you can show how to only bold the above phrases, within the string of many, I will be very grateful.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,643

    Re: Automatically bold certain phrases within a cell

    C24 has a very long concatenation formula, not a string value; you can't bold parts of it.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Re: Automatically bold certain phrases within a cell

    How can I achieve the same outcome (a list of phrases) whilst also being able to bold certain phrases?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Automatically bold certain phrases within a cell

    Hello AFawcett,

    I added a formula, a column, and conditional formatting to the "R-Phrases" worksheet. When the value in B24 of the "Summary" worksheet changes, the phrases that have a "Y" in the row for that reagent will be made bold on the "R-Phrases" worksheet. The formula in C24 of the "Summary" worksheet has been discarded. The attached workbook has the changes already made.

    Formula in Column "C1" of the worksheet "R-Phrases"
    =INDEX(Reagents!$G$6:$BV$12,MATCH(Summary!$B$24,Reagents!$A$6:$A$12,0),ROW())

    Conditional Formatting Rule in B1
    Rule Type: User Formula to determine which cells to format
    Formula: =OFFSET($B1,0,1,1,1)="Y"
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Re: Automatically bold certain phrases within a cell

    Hi Leith Ross

    I follow what you have done, but it's unfortunately not what I require. The formula in C24 is required as I need the generated list of phrases to be present on the Summary worksheet.

    I have found a semi-workaround myself using the UPPER function, where each phrase I need highlighting in bold is now highlighted in capitals instead.

    Is there a way to create a "BOLD" function that works identically to the UPPER function, but changes the text from normal to bold instead?

    Thanks

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,643

    Re: Automatically bold certain phrases within a cell

    One solution is to have the macro replace the formula results with the concatenated string values. The parts of the string can be individually formatted but you will loose the formula. Or, you can leave C24 as is and have a copy of the values elsewhere on the sheet

  9. #9
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Re: Automatically bold certain phrases within a cell

    Quote Originally Posted by protonLeah View Post
    One solution is to have the macro replace the formula results with the concatenated string values. The parts of the string can be individually formatted but you will loose the formula. Or, you can leave C24 as is and have a copy of the values elsewhere on the sheet
    I think I am following what you're saying...

    Are you suggesting that I put my current formula in C24 elsewhere, for example in D24, then have C24 = D24. This will then generate a string of text, and not concatenated string value, that I can individually format using a macro?

    Thanks

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,643

    Re: Automatically bold certain phrases within a cell

    The macro below has to be edited to list the r-phrases to be bolded. I then clears summary C24. it finds the summary B24 value in the reagents sheet column A. It tests the r-phrases in that row for "Y" and builds a string appending the phrases to the end of the string. The final string is copied to summary C24 and the code searches the sting for the r-phrases specified and bolds that phrase.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-31-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    10

    Re: Automatically bold certain phrases within a cell

    Wow nice job. This is exactly what I was looking for. I had settled for a lesser option (bolding the whole string of text if a certain phrase appears), but will now update my spreadsheet to fit this in!

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] automatically bold a whole row of data
    By profitdr123 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 11-24-2013, 06:11 PM
  2. Separating Bold from After-Bold Parts of Cell Strings
    By mlexcelhelpforum in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2012, 07:11 AM
  3. Compare lists of phrases in two workbooks and import only missing phrases
    By Fireblejd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2011, 06:59 AM
  4. Look for Certain Phrases in Cell
    By cappa in forum Excel General
    Replies: 2
    Last Post: 01-20-2011, 05:23 PM
  5. Macro to automatically format cell w/bold once selected using keyboard
    By Shibu_john1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2010, 02:27 PM
  6. how to count phrases in a cell
    By rcorkum in forum Excel General
    Replies: 1
    Last Post: 06-26-2010, 09:34 PM
  7. Join bold and non-bold text in one cell
    By bkincaid in forum Excel General
    Replies: 3
    Last Post: 03-20-2006, 09:10 PM
  8. Replies: 1
    Last Post: 02-02-2005, 10:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1