简体   繁体   English

Excel“插入形状”根据单元格值进行颜色更改

[英]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. 任何人都知道如何根据单元格的值更改Shapes(“ Insert-> Shapes”)的颜色。 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: 示例如何在ActiveX图像控件中显示命名范围的图片:

  1. Open Excel with a empty Worksheet Sheet1. 用一个空的工作表Sheet1打开Excel。
  2. Write 0 in A1. 在A1中写入0。
  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 使用名称管理器创建命名范围http://office.microsoft.com/zh-cn/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) 引用== =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 从“开发人员”选项卡中获取一个ActiveX图像控件
    ( http://office.microsoft.com/en-us/excel-help/show-the-developer-tab-HA101819080.aspx ) Controls and put it in the Worksheet. http://office.microsoft.com/zh-cn/excel-help/show-the-developer-tab-HA101819080.aspx )控件并将其放在工作表中。
  2. Overwrite the formula =EMBED(...) in the formula bar with =Image (the name of the named range). =Image (命名范围的名称=EMBED(...)覆盖公式栏中的公式=EMBED(...) )。 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. 现在,如果更改Sheet1!A1的值,则应在图像控件中看到单元格E[n]:E[m]其中n=A1*4+1m=A1*4+4 Try it by putting values in E1:E20 and change A1 . 通过将值放入E1:E20并更改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 . 现在,如果将不同的形状放在E1:E4, E5:E8, E9:E12,...可以通过更改A1的值在图像控件中看到它们。

Edit April 2019: 编辑2019年4月:

This works using Excel 2007 . 这可以在Excel 2007使用。 It does not work in later Excel versions because the ActiveX Image control does not more accept cell ranges as source. 它不能在更高的Excel versions因为ActiveX Image控件不再接受单元格区域作为源。

Just tested in Excel 365 : 刚刚在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. 将一列的四个单元格(例如A1:A4 )复制到剪贴板中。 It is not important from where the cells are coming. 细胞来自何处并不重要。
  2. In the sheet where the image shall appear do Home -> Paste -> Linked Picture . 在将出现图像的工作表中,执行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. 例如,公式栏显示公式=Sheet1!$A$1:$A$4
  3. Overwrite the formula in the formula bar with =Image (the name of the named range). =Image (命名范围的名称)覆盖公式栏中的公式。 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. 现在,如果更改Sheet1!A1的值,则应将粘贴的图片中的n=A1*4+1m=A1*4+4的单元格E[n]:E[m]看到。 Try it by putting values in E1:E20 and change A1 . 通过将值放入E1:E20并更改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 . 现在,如果将不同的形状放在E1:E4, E5:E8, E9:E12,...可以通过更改A1的值在粘贴的图片中看到它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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