• 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
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

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

office scripts course

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
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: 1548
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: 1548
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: Norilina Harvel, Jason Fitzpatrick
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Trevor Pindling
Stevan Kanjo
Erin Sheldon
Nikita Bhatia
Sheilah Taylor
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Jennifer Owens
Forum Stats:
Groups: 3
Forums: 24
Topics: 6524
Posts: 28554

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.