+ Reply to Thread
Results 1 to 3 of 3

Automatic color change of a rectangle when cell changes.

Hybrid View

  1. #1
    Registered User
    Join Date
    03-16-2015
    Location
    memphis
    MS-Off Ver
    2003
    Posts
    2

    Automatic color change of a rectangle when cell changes.

    Hi all,
    This is my first time posting and I am a very amateur excel operator.
    I have a project which I am making where I need a rectangle to change automatically when the text inside a cell changes from C to P.
    I am assigning the below macro to the rectangle.
    It does not change automatically when I change the text in cell R22 you then have to click the rectangle for it to change color.

    Anyones help would be greatly appreciated.

    Sub Rectangle33_Change()
    Dim ColorNum As Integer

    If ActiveSheet.Range("$r$22") = "C" Then
    ColorNum = 3 'green
    ElseIf ActiveSheet.Range("$r$22") = "P" Then
    ColorNum = 5 'yellow
    End If

    ActiveSheet.Shapes("Rectangle 33").Fill.ForeColor.SchemeColor = ColorNum

  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,876

    Re: Automatic color change of a rectangle when cell changes.

    Are you not considering using Conditional Formatting, by changing the Cell Border color instead of the Rectangle?
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    03-16-2015
    Location
    memphis
    MS-Off Ver
    2003
    Posts
    2

    Re: Automatic color change of a rectangle when cell changes.

    Hi
    Thank you for your quick response.
    I cant use CF because the rectangle I am using is layered on top of a picture image in my document.
    I have used CF in many cases in the document and so that is why I have used the macro.

+ 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. Automatic Text Color Change?
    By newguy91401 in forum Excel General
    Replies: 1
    Last Post: 07-16-2009, 02:40 PM
  2. Automatic Color Change
    By Chris in forum Excel General
    Replies: 4
    Last Post: 03-30-2006, 04:25 AM
  3. Replies: 1
    Last Post: 03-06-2006, 04:10 PM
  4. [SOLVED] RE: Automatic Color Change
    By Gary''s Student in forum Excel General
    Replies: 0
    Last Post: 02-04-2006, 03:10 PM
  5. HOW DO I CHANGE THE AUTOMATIC BORDER COLOR IN EXCEL?
    By mhbento in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-16-2005, 06: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