+ Reply to Thread
Results 1 to 21 of 21

Macro Button to highlight specific text and change color If another column is empty

  1. #1
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Unhappy Macro Button to highlight specific text and change color If another column is empty

    Morning all,

    I hope you can help me out?

    I have attached a copy of the doc With my current code. At the moment I have only been able to get to step one of the rules I'm trying to create.


    I'm trying to create a Macro button that has the following rules.



    When material in Column B with the following abbreviations is highlighted.



    abbreviations are:- SHS, PFC, CHS, UC, UB, RHS, RSC, RSA, Key Steel, L1770, AWG, Bar, ACME, All Thread and Wear Strip.



    If length in column H is present then text for both columns is highlighted in green.



    If length is not present in Column H then material text is highlighted in red.


    Any help would be greatly appreciated!


    Cheers,
    Attached Files Attached Files

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi,

    I might need some more clarity on the Abbreviations part.

    I have this to start with, just select the cell in the Materials column (Clicking on button is not needed)

    Let me know if you need anything else

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Cheers!
    Deep Dave

  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi
    What about

    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.
    Last edited by mohadin; 03-11-2021 at 05:50 AM.

  4. #4
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi Dave,

    Thanks for your time!

    What you have provided is great.

    But the reason for having the button is due to the bill of material normally being a large file with hundreds of parts. So a simple button would just be a 1 click operation, and would highlight the materials with the abbreviations and any missing values.

    The abbreviations are certain materials that are required to be cut lengths. And the manufacturing department are looking for a system to check the bills of material to see if any lengths have been missed.

    If there is away of combining what you have provided into a button click macro then it would be perfect!

    Thanks again,

    Nick H

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro Button to highlight specific text and change color If another column is empty

    Try this attachment
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi Mohadin,

    Thanks for looking into this for me.

    When I use the code you have provided I'm getting an error message. Regarding End Sub?

    Cheers,

    Nick H

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Button to highlight specific text and change color If another column is empty

    @NickH101

    Alright, so basically you are fine with the solution, but just need it on the click of a button?

    Also, do you want to Highlight only the 1 particular row, or all the rows? I need clarity over it

  8. #8
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi Dave,

    Yes that is exactly what I need.

    I would like it to select all rows that have the abbreviations.

    Cheers,

    Nick H

  9. #9
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Quote Originally Posted by mohadin View Post
    Try this attachment
    I have tried it and It worked fine.

    The issue I'm having now when I import it into a another document It wont work.

    The Document I provided was edited to just show only a few fields.

    I have attached a copy of a full bill of material.

  10. #10
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Oh Doh!

    I inputted the wrong Row numbers!

    You can tell this is all new to me.

    All working fine now!

    Much appreciated!

    Nick H

  11. #11
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro Button to highlight specific text and change color If another column is empty


  12. #12
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Quote Originally Posted by mohadin View Post
    I hope I did understand
    Almost Mohadin,

    Please see attached! Just need to change it to row 8.

    The last bit now is that it highlights all of row 8 in red.

    Is there a way of changing the other cells that are not part of the pattern in a different color Like Blue.

    So only the cells with the pattern are red or green dependent on length being present.

    Cheers,

    Nick H.

  13. #13
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro Button to highlight specific text and change color If another column is empty

    Ok
    Let me know if this what you want
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Quote Originally Posted by mohadin View Post
    Ok
    Let me know if this what you want
    Almost,

    just need to be able to use the button command so It only highlights the abbreviations and missing lengths.

    As currently the whole column is red which makes it hard to read which one is missing a length.

    Cheers,

    Nick H.

  15. #15
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi,

    Please try this out

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

  16. #16
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Macro Button to highlight specific text and change color If another column is empty

    Hi
    Perhaps something like
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Quote Originally Posted by NeedForExcel View Post
    Hi,

    Please try this out

    Please Login or Register  to view this content.
    Works great as a macro! Thanks for your help.

  18. #18
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Quote Originally Posted by mohadin View Post
    Hi
    Perhaps something like
    Please Login or Register  to view this content.
    Works great as a button command!

  19. #19
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Button to highlight specific text and change color If another column is empty

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  20. #20
    Registered User
    Join Date
    03-11-2021
    Location
    Wales UK
    MS-Off Ver
    Excel
    Posts
    13

    Re: Macro Button to highlight specific text and change color If another column is empty

    Great help from you both! Rep added and a BIG thanks to you both

  21. #21
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Macro Button to highlight specific text and change color If another column is empty

    You are welcome, and glad I could help!

+ 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. Change the fill color of a specific cell by the click of a button
    By DuxAhx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-18-2017, 05:31 AM
  2. [SOLVED] Highlight/Change Font Color of text [2010/2011 Mac)
    By ext1jdh in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-22-2015, 11:14 AM
  3. [SOLVED] Make cell change color and add text via BUTTON + MACRO
    By Wise_87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2015, 12:51 AM
  4. Search Column for Specific Value and Change Text Color Property for Entire Row.
    By TomToms in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2014, 04:15 PM
  5. Change the Specific color using button VBA
    By skhari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2012, 04:01 PM
  6. [SOLVED] Change text color of specific date range by macro in Excel
    By Morgan LeFay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2006, 02:55 PM
  7. Replies: 2
    Last Post: 01-27-2005, 02:06 PM

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