+ Reply to Thread
Results 1 to 4 of 4

Macro to automatically highlight cells.

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    I'm, Paranoid
    MS-Off Ver
    Excel 2010
    Posts
    4

    Macro to automatically highlight cells.

    I have a worksheet with a table that records payments with prepaid debit cards for my company. In this table, there is a new entry for each purchase, so people will be entered in the table. Since the table is sorted by the people's names, I want rows to automatically highlight a certain color according to the person's name every time a new entry is created. There is about 13 people who could possibly show up on this list, so I wasn't sure that I could do it just with conditional formatting (although if know a way to do it with that, I would love to hear it). Capture.PNG

    Thanks for helping me out with this, I appreciate it.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Macro to automatically highlight cells.

    Hi and welcome to the forum

    You should be able to do this pretty easily with Conditional Formatting - it will take 13 rules (or however many people you have). Assuming the peoples names are in A, starting in A2, try this...

    1. highlight the range you want to apply the conditional formatting to
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =$A2="David" format fill the colur you want.

    repeat 3 & 4 for each name

    If you still have a problem, i would suggest you upload a sample work book (NOT a picture), (all sensitive data removed), showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that
    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-08-2013
    Location
    I'm, Paranoid
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to automatically highlight cells.

    Thanks, that was exactly what I needed! I didn't know that you could assign multiple conditional formats to a single range, but I found the manage rules dialog box and everything works perfectly!!

  4. #4
    Registered User
    Join Date
    07-08-2013
    Location
    I'm, Paranoid
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to automatically highlight cells.

    Well crap, even though it works fine, my boss wants me to make a table with the person's name and the rgb values for the desired color. Then the macro would take the name and colors and conditional format from that. I already have some idea of how I'm going to do it, but I don't know how to conditional format from vba. Do you know the command and syntax for it?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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