+ Reply to Thread
Results 1 to 5 of 5

Change range cell color if cell is TRUE

  1. #1
    Registered User
    Join Date
    08-25-2015
    Location
    Jax FL
    MS-Off Ver
    office 2010
    Posts
    15

    Change range cell color if cell is TRUE

    This is what i have.

    Private Sub color1()

    End Sub

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("K10").Value = "true" Then
    Range("B10:H10").Select
    With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorLight2
    .TintAndShade = 0.599993896298105
    .PatternTintAndShade = 0
    End With
    End If
    End Sub

    can someone please help me

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Change range cell color if cell is TRUE

    Hi,

    You can simplify your code like this:
    Please Login or Register  to view this content.
    Notes:
    1. "true" is a string while True is a boolean value.
    2. Avoid selecting cells, it slows down the macro

    This code will always fill the same cells in blue based on the value of K10

    If it's some kind of conditional formatting that you want, when the vlaue in K is true, you may use this:
    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    08-25-2015
    Location
    Jax FL
    MS-Off Ver
    office 2010
    Posts
    15

    Re: Change range cell color if cell is TRUE

    This is the worksheet.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-25-2015
    Location
    Jax FL
    MS-Off Ver
    office 2010
    Posts
    15

    Re: Change range cell color if cell is TRUE

    I forgot to say the "K" column text will be turned to white.

  5. #5
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Change range cell color if cell is TRUE

    Hi sherrillpitts,

    As an alternative to VBA/Macros, why not just use Conditional Formatting.
    Please note I have added a column for the "Y" (and would not use tick-boxes) in the attached option.
    Regards
    peterrc
    Attached Files Attached Files

+ 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 a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  2. change fill color of a range of cells based on color of a cell?
    By DarMelNel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 04:48 PM
  3. [SOLVED] vba code to change the cell color by looking in a range that contains the color index valu
    By ckklconner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2013, 09:15 AM
  4. Replies: 11
    Last Post: 08-31-2010, 01:30 PM
  5. [SOLVED] Change Color Of Cell Range When Last Cell Receives Data
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2009, 03:27 PM
  6. Replies: 1
    Last Post: 03-12-2008, 06:35 PM
  7. How do I change cell color based upon data range within the cell?
    By Chris Sanders in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-06-2006, 04:59 PM

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