One object reference another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have one shaded box and and I want another shaded box to always be the same
color as the first. Is there a way to link the two so when i chence the color
on the main one, the second one will also change, without programming. Didn't
know if there was a way to put a formula in for a shape.
 
when you say box do you mean a rectangle? ie drawn from the drawing
toolbar? or do you mean a cell.
i'm pretty sure you need some code for this

right click on the sheet in which your rectangles sit and select view
code
select from the first dropdown box at the top of the page Worksheet
then from the next Selection change

ensure the code in the winddow below looks like this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Shapes("Rectangle 2").Fill.ForeColor.SchemeColor = _
ActiveSheet.Shapes("Rectangle 1").Fill.ForeColor.SchemeColor
End Sub

this assumes your second rectangle is rectangle 2 and your first
rectangle 1

somethinglikeant
 
Thanks. I just was trying to avoid having to actually run a macro. Didn't
think about doing one that would run as soon as the change was made. Works
great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top