+ Reply to Thread
Results 1 to 3 of 3

Thread: cell range format based on another cell value

  1. #1
    Registered User
    Join Date
    07-22-2011
    Location
    illinois
    MS-Off Ver
    Excel 2007
    Posts
    1

    cell range format based on another cell value

    I would like to change the visual format of a range of cells based on the value I choose in a different cell.

    Example: Based on the value entered in to cell B8 (an X or an 0), I would like a range of cells (F10;G14) to change the font color.

    ---------------------
    Also, is there a way change the color of a font of a cell, if the value of that cell, is equal to the value in a range of cells?

  2. #2
    Valued Forum Contributor
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    412

    Re: cell range format based on another cell value

    try this code in sheet where you want to use this formatting
    Private Sub Worksheet_Change(ByVal Target As Range)
     If Target.Address = "$B$8" Then
      Set Rng = Range("F10:G14")
        Select Case UCase(Target.Value)
            Case "X":
                Rng.Interior.ColorIndex = 3
            Case 0:
                Rng.Interior.ColorIndex = 45
            Case "":
                Rng.Interior.ColorIndex = none
            Case Else
                Rng.Interior.ColorIndex = none
        End Select
     End If
    End Sub
    Best Regards
    MaczaQ
    Last edited by maczaq; 07-22-2011 at 04:37 PM. Reason: code update

  3. #3
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,238

    Re: cell range format based on another cell value

    You could do this with Conditional Formatting.


    See the attached example workbook.


    Regards
    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)

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.2.0