+ Reply to Thread
Results 1 to 15 of 15

Multiple text coloring in same cell using listboxes

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Multiple text coloring in same cell using listboxes

    Hello,

    I've got the beginning of my database set up with tables and listboxes. A problem that I am encountering is that when a user chooses multiple selections from the listbox, I would like for the contents that are returned to the cell to be color coded based upon the selections. For example, in the same cell, there might be some text in a red font, indicating a low rating, some text in a yellow font indicating a moderate rating and a green font indicating a good rating.

    Is this even possible? I'm pretty sure that I can't have different colors show up INSIDE the listbox. So I was wondering if its possible to to have different multiple colors in one cell in Excel?

    It would need to be automated (everytime a specific string of words is used it would be red, everytime a different specific string of words is used it would be green, for example), and Conditional Formatting does not seem to be possible because that impacts all of the contents within the cell the same way.

    Any ideas?

    Thanks,

    Mark
    Last edited by marksm33; 02-24-2013 at 02:07 PM. Reason: SOLVED!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    Mark

    It should be possible but I think we'd need more details to suggest specific code.

    Perhaps you could attach a sample workbook.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    Quote Originally Posted by Norie View Post
    Mark

    It should be possible but I think we'd need more details to suggest specific code.

    Perhaps you could attach a sample workbook.
    Thanks, so much. If you can help make this work, you are an official genius

    Attached is a sample of the full database. Thanks in advance for any help you can provide

    Mark
    Attached Files Attached Files

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    Mark

    Are multple selections allowed for the first column?

  5. #5
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    Quote Originally Posted by Norie View Post
    Mark

    Are multple selections allowed for the first column?
    I'd prefer no. But if it has to be that the same Listbox settings are used for each column, then I can live with it being open to multiple. No one would ever use multiple for the colA.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    The reason I asked was because the listbox didn't seem to be populating properly for column B.

    I changed the code to this to only allow one selection in column A.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    I tried the new code, Norie, but got an error when I clicked on ColB. It now always gives me the same choices regardless of the choice made in ColA? I've tried changing some of the code to make it work, but to no avail? Any help would be appreciated,

    Mark

    I've attached the updated file with the updated code, so you can see if you get the same results that I do. Thanks again.
    Attached Files Attached Files

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    Mark

    I didn't encounter that error but the listbox seemed to act quite weird.

    For example, when I tried to select something at the top of the list it would kind of jump down and select other items.

    Also, when the listbox appeared seemed a bit erratic.

    Have you considered using a userform instead?

    Might be a bit more 'stable'.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    Right, I know what the problem is with the code, well the code and the data actually.

    You've add 1a, 1b etc to the components so there are no matches in the Select Case statement.

    Also the Select Case should start like this.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    Quote Originally Posted by Norie View Post
    Right, I know what the problem is with the code, well the code and the data actually.

    You've add 1a, 1b etc to the components so there are no matches in the Select Case statement.

    Also the Select Case should start like this.
    Please Login or Register  to view this content.

    Thanks, Nori. That did fix the problem when I changed the data back to the way it was

    It's ALMOST there. The conditional formatting that was entered, changes the whole cell to be the same depending on the selections. What I was looking for was like in this example. I need it to happen automatically so the user doesn't have to individually have to go back into the function menu to change the specific string of text. I'd like for Excel to automatically recognize the specific string of text and color it automatically, so you could have two to four different colored texts in one cell.

    I hope that makes sense. I've attached an updated sample to explicitly show what I'm talking about.

    Again, thanks for all of your help on this. You're awesome!

    Mark
    Attached Files Attached Files

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple text coloring in same cell using listboxes

    Mark

    I know what you want to do, I think anyway.

    Just kind of wanted to sort out a few other things first.

    I actually started looking at the formatting/colour thing last night but it was late, should have more time tonight.

  12. #12
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Multiple text coloring in same cell using listboxes

    Hi Mark
    try it (see attachment)
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    Nilem,

    I can't thank you and Nori enough! That is absolutely amazing! You just saved me Weeks and Weeks of Work! You both get the Excel Genius Medal from me Thank you, thank you, thank you!

    Mark

  14. #14
    Registered User
    Join Date
    02-20-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Multiple text coloring in same cell using listboxes

    Nilem, This is just perfect. Again, I can't thank you enough. There's just one itsy bitsy small little thing which I've tried to accomplish moving around the column references in the VBA code but can't figure out. I'd like to add two columns on the first sheet where the User just enters text. ColA would be Evidence1 and ColB would be Rating1 I can't seem to be able to figure out how to do that.

    Also, Under the Rating Column in the first sheet, ColD, I'm using the old DataValidation Method. I cant seem to be able to figure out how turn that into a ComboBox with the same selections.

    Once again in advance, deepest thank yous!

    Thanks again, Mark

  15. #15
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Multiple text coloring in same cell using listboxes

    Hi Mark
    if I understand correctly your "one itsy bitsy small little thing" (I still have long to learn English ), then see attached file
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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