简体   繁体   中英

Excel “Insert shapes” Color change based on cell value

Anyone knows how to Change the color of Shapes("Insert-> Shapes") based on the value of a cell. i could do this with the help of macro. but i now need the same to be done without the help of macro.

Kindly share the formula if anyone can do this.

thanks.

Example how to show the picture of a named range in a ActiveX image control:

  1. Open Excel with a empty Worksheet Sheet1.
  2. Write 0 in A1.
  3. Create a named range using the Name Manager http://office.microsoft.com/en-us/excel-help/define-and-use-names-in-formulas-HA010147120.aspx#BMmanage_names_by_using_the_name_manage

to do so:

  • open Name Manager
  • click New
  • Name= Image
  • Refers To= =INDEX(Sheet1!$E:$E,Sheet1!$A$1*4+1):INDEX(Sheet1!$E:$E,Sheet1!$A$1*4+4)
  • OK
  • close Name Manager

now:

  1. Take a ActiveX Image Control from Developer tab
    ( http://office.microsoft.com/en-us/excel-help/show-the-developer-tab-HA101819080.aspx ) Controls and put it in the Worksheet.
  2. Overwrite the formula =EMBED(...) in the formula bar with =Image (the name of the named range). Now, if you change the value in Sheet1!A1 , you should see the cells E[n]:E[m] with n=A1*4+1 and m=A1*4+4 as picture in the Image Control. Try it by putting values in E1:E20 and change A1 .
  3. Now, if you place different shapes over E1:E4, E5:E8, E9:E12,... you see them in the Image Control by changing the value in A1 .

Edit April 2019:

This works using Excel 2007 . It does not work in later Excel versions because the ActiveX Image control does not more accept cell ranges as source.

Just tested in Excel 365 :

First do the same steps as above but then in last step

now:

  1. Copy four cells of one column ( A1:A4 for example) into the clipboard. It is not important from where the cells are coming.
  2. In the sheet where the image shall appear do Home -> Paste -> Linked Picture . A picture showing the copied cells is pasted. And the formula bar shows the formula =Sheet1!$A$1:$A$4 for example.
  3. Overwrite the formula in the formula bar with =Image (the name of the named range). Now, if you change the value in Sheet1!A1 , you should see the cells E[n]:E[m] with n=A1*4+1 and m=A1*4+4 as picture in the pasted picture. Try it by putting values in E1:E20 and change A1 .
  4. Now, if you place different shapes over E1:E4, E5:E8, E9:E12,... you see them in the pasted picture by changing the value in A1 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM