• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Change the Color of keywords in a Text|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Change the Color of keywords in a Text|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosChange the Color of keywords in a T…
sp_PrintTopic sp_TopicIcon
Change the Color of keywords in a Text
Avatar
maggie powell

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 26, 2020
sp_UserOfflineSmall Offline
1
May 26, 2020 - 8:45 am
sp_Permalink sp_Print

Hi,

I have a customer feedback data in "comments sheet" in column B and i want to color the keyword that are in "Keywords" sheet (3 columns with different keywords categories about the service:- Good, bad and neutral keywords 40-50 rows), like Good keywords in Green, Bad in Red and Neutral in Amber.

Can you help me with the code, that can find the those keywords and change their font color as per above.?

Please find the attached file, I've only included few comments and keywords.(there are many more)

I've highlighted the keyword on "Comments" sheet that are matching from my "Keywords"  sheet in a color as per the keyword category it belongs (expected Output)

Example:-

comments sheet cell B2-

"Like", "company" in GREEN because both keywords are under GOOD category, in my "keywords" sheet cell A2, A3

"Rude", "Tone" and "attitude" in RED, because all 3 keywords are under BAD category, in my "keywords" sheet cell B2, B7, B10

"advised" in AMBER, because the keyword is under NEUTRAL category, in my "keywords" sheet cell C3.

 

Let me know if you have any question with this query.

I really appreciate you quick response and help!

 

Thanks in advance!!

Maggie

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
May 26, 2020 - 10:54 am
sp_Permalink sp_Print

Hi Maggie,

See attached.

To run the code, click into a cell where the text is that you want to check e.g. A1 then click the blue button 'Color Words'.

Regards

Phil

Avatar
maggie powell

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 26, 2020
sp_UserOfflineSmall Offline
3
May 29, 2020 - 9:27 am
sp_Permalink sp_Print

Hi Phil,

 

Instead of hard coding the keywords and colors, can we do some like.
If a keyword is presented in a Column A then color it Green, if its in column B then Red color and if its from C color it Orange.
This will be much helpful if i want to add more keywords, or change some keywords, i'll simply add in the range and change the code.

so, can we change the keywords by defining a column range as an array, and specifying color if its from a particular array?

something of this sort:-

Good = Sheets("Keyword").Range("A1:A11").Value
Bad = Sheets("Keyword").Range("B1:B11").Value

Neutral = Sheets("Keyword").Range("C1:C9").Value

MyWords = VBA.Array(Good, Bad, Neutral)

MyColors = VBA.Array(vbGreen, vbRed, mothOrange)

 

please help!

 

Thanks,
Maggie

Avatar
maggie powell

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
May 26, 2020
sp_UserOfflineSmall Offline
4
May 29, 2020 - 10:38 am
sp_Permalink sp_Print

Phil, its only changing the color of "time"  and showing me a "Type mismatch" error.

Attaching the data file. 

Comments sheet- is the raw data, i want to color basis the keywords in the next sheet as per their type.(as above)

please run it at your end and advise me.

 

Thanks!

Maggie

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
5
May 29, 2020 - 12:00 pm
sp_Permalink sp_Print

Hi Maggie,

I was working on this update (attached) and as I go to post it I see your latest message.

Please try using this new version to see if it overcomes your issue. 

It uses 3 tables which you'll find on the Keywords sheet.  Everything is dynamic so add/remove words to these tables as you wish.

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Anders Sehlstedt, RAQUEL ACION, Chandler Davis, gogy13, Brenda Richards, Mark Luke
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 202
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Mark Luke
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
Forum Stats:
Groups: 3
Forums: 24
Topics: 6218
Posts: 27267

 

Member Stats:
Guest Posters: 49
Members: 31901
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.