+ Reply to Thread
Results 1 to 5 of 5

Macro to color groups of cells based on column values

  1. #1
    Registered User
    Join Date
    01-12-2010
    Location
    south bend, in
    MS-Off Ver
    Excel 2000
    Posts
    31

    Macro to color groups of cells based on column values

    I'd like a macro that I can change the background color from column A thru I based on a word from a drop down menu in column G. I would do conditional formatting but I have more then 3 words. I would like different colors for each word and have the macro do it automatically.

    I found this code but it only colors the cell in column G and not columns A thru I...... any help modifiying it would help too....

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim icolor As Integer

    If Target.Column <> 7 Then Exit Sub
    'change the conditions below
    Select Case Target.Value
    Case "Cmpl"
    Case "In Progress"
    icolor = 6
    Case 1 To 9
    icolor = 45
    Case 1 To 9
    icolor = 3
    Case Else
    'Whatever
    End Select

    Target.Interior.ColorIndex = icolor

    End Sub


    Thanks!!

  2. #2
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to color groups of cells based on column values

    Like so:
    Please Login or Register  to view this content.


    As per forum rules, be sure to edit your post above and add code tags, like I've shown here. There's lots of useful helps and tip in the Forum Rules link (above in the light blue menu bar).
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-12-2010
    Location
    south bend, in
    MS-Off Ver
    Excel 2000
    Posts
    31

    Re: Macro to color groups of cells based on column values

    Thanks, is there a link so i know what the colors to choose from are? i'm looking for gray, green, red, yellow ect...

  4. #4
    Registered User
    Join Date
    01-12-2010
    Location
    south bend, in
    MS-Off Ver
    Excel 2000
    Posts
    31

    Re: Macro to color groups of cells based on column values

    never mind i did a quick google search and found it

  5. #5
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to color groups of cells based on column values

    If that takes care of your need, please click Thread Tools above your first post and mark this thread as SOLVED.

+ 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