+ Reply to Thread
Results 1 to 4 of 4

Change a cells fill color. VBA to make another cell the same color and also changes.

Hybrid View

PeteABC123 Change a cells fill color.... 03-23-2016, 10:50 AM
walruseggman Re: Change a cells fill... 03-23-2016, 11:59 AM
PeteABC123 Re: Change a cells fill... 03-23-2016, 12:28 PM
walruseggman Re: Change a cells fill... 03-23-2016, 12:34 PM
  1. #1
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Change a cells fill color. VBA to make another cell the same color and also changes.

    A coworker has asked me:
    If I make A1 a red fill, can I have E1 also change to red automatically, (or to whatever color A1 gets changed to?)

    I have no idea.


    A1 fill color is not dependent on it's value, or on another cells value. . .

    Anyone have some code that can do this?

    TIA.

    Pete

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Change a cells fill color. VBA to make another cell the same color and also changes.

    There's no event handler for formatting changes, but I suppose you could sorta replicate it with SelectionChange. Change the color of A1, then select any cell. At that point E1 color will change to A1 color.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    [E1].Interior.Color = [A1].Interior.Color
    End Sub
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Change a cells fill color. VBA to make another cell the same color and also changes.

    walruseggman:

    This works for us. Thank you for your expertise and grey matter exercise.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    [E1].Interior.Color = [A1].Interior.Color
    [E2].Interior.Color = [A2].Interior.Color
    [J18].Interior.Color = [A18].Interior.Color
    End Sub
    Pete

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Change a cells fill color. VBA to make another cell the same color and also changes.

    Glad to help. Please mark the thread SOLVED

+ 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. Replies: 7
    Last Post: 10-01-2015, 04:45 PM
  2. [SOLVED] Click oval option button to fill/unfill color, also change border color to match fill
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2015, 08:29 PM
  3. Macro to change cell text color based on darkness of cell fill color
    By cincyshirm61 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2014, 12:11 PM
  4. [SOLVED] 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
  5. Replies: 0
    Last Post: 09-26-2012, 01:08 PM
  6. How do i auto fill cell color based on other cells' color?
    By Kchatza in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2012, 05:00 AM
  7. Replies: 3
    Last Post: 07-08-2010, 06:48 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