Solved

Excel 2016 VBA change shape fill color to that of a cell fill color

Posted on 2016-11-01
2
47 Views
Last Modified: 2016-11-01
I can see how to do that with RGB for a Shape, but as far I can see cell interior color is not available as RGB.

I'm trying to make the interior fill color of a shape equal to the fill color of a specified cell.

Thanks for any help.
0
Comment
Question by:hindersaliva
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41868646
Hi,

pls try
Sub Macro1()

    Set shp = ActiveSheet.Shapes(1)
    With shp.Fill
        .Visible = msoTrue
        .ForeColor.RGB = Range("A1").Interior.Color
        .Transparency = 0
        .Solid
    End With
    
End Sub

Open in new window

Regards
0
 

Author Comment

by:hindersaliva
ID: 41868796
Perfect Rgonzo!
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

1 Experts available now in Live!

Get 1:1 Help Now