条件格式设置即使在打印时也可以隐藏单元格内容

发布于 2024-10-21 02:04:08 字数 266 浏览 7 评论 0原文

我想设置一个条件格式设置,如果单元格的内容等于另一个单元格,该设置将隐藏内容(单元格应该看起来为空白)。有谁知道有一个函数可以做到这一点?我尝试使字体与背景颜色相同(在本例中为灰色),但不幸的是,当打印时,文本中留下了某种残留阴影。

这是当我对灰色进行灰色处理时发生的情况(它们应该是相同的颜色):

灰色对灰色仍然显示

I我在 Mac 上使用 Excel 2008。

I would like to set up a conditional formatting setting that would hide the contents (the cell should look blank) if the cell's contents is equal to another cell. Does anyone know of a function to do this? I tried just making the font the same color as the background (gray, in this case), but unfortunately when this is printed, there is some sort of residue shadow left over from the text.

Here is what happens when I do gray on gray (they are supposedly the same color):

Gray on gray still shows up

I am using Excel 2008 on the Mac.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

鼻尖触碰 2024-10-28 02:04:08

下面的 A2 中我们有条件格式,如果该单元格的内容等于 B2,则隐藏该单元格的内容。

在此处输入图像描述

在条件格式中创建以下规则:=$A$2=$B$2,然后按格式...

在此处输入图像描述

  1. 在“格式”菜单上,单击“单元格”,然后单击“数字”选项卡。
  2. 在“类别”下,单击“自定义”。
  3. 在“类型”框中,键入 ;;; (即连续三个分号),然后单击“确定”。

在此处输入图像描述

Below in A2 we have the conditional formatting that hides the content of that cell if it is equal to B2.

enter image description here

In Conditional Formatting create the following rule: =$A$2=$B$2, then press Format...

enter image description here

  1. On the Format menu, click Cells, and then click the Number tab.
  2. Under Category, click Custom.
  3. In the Type box, type ;;; (that is, three semicolons in a row), and then click OK.

enter image description here

十年九夏 2024-10-28 02:04:08

解决这个问题的另一种方法是一种破解,但它应该可行:

  • 有两张表,数据和视图,
  • 将视图表上的条件格式设置为数据表中的值(不确定这是否是一个选项...)
  • 使用 if 语句每个单元格都显示类似 if(dataCell=matchCell, "", dataCell)

another way around this is a hack but it should work:

  • have two sheets, data and view
  • base your conditional formatting on the view sheet off of values in the data sheet (not sure if this is an option...)
  • use if statements in each cell that say something like if(dataCell=matchCell, "", dataCell)
謌踐踏愛綪 2024-10-28 02:04:08

我怀疑打印问题与其说是Excel的问题,不如说是打印机的一个功能。
打印机制造商显然希望在打印页面上获得“最佳”结果。有些人会通过做一些事情来优化颜色,例如使较小的印刷量(例如图表和线条)稍微暗一点,大面积(例如单元格背景稍微亮一点)。这样,当它们并排放置时,它们看起来颜色相同。然而,当根据您的情况相互打印时,您会得到残留效果。

这源于一个众所周知的效应,即对于任何给定的颜色,该颜色的大面积看起来会比完全相同颜色的小区域看起来更暗。还有其他效果可以产生这种错觉,例如背景和附近的颜色。举个例子 - 这与你的不完全相同 - 但说明了这种错觉,请在网上搜索“阿德尔森棋盘”并阅读解释。

无论如何,mpalanco 提出的解决方案(使用三个分号的条件格式)是实现干净结果的最简单方法 - 每次都打印到纸上、打印到 pdf 上、在屏幕上和任何其他形式上。

I suspect that the printing problem is not so much a problem with Excel, but a feature of the printer.
Printer manufacturers obviously want to get the "best" result that they can on a printed page. Some will optimise colour by doing things like making smaller volumes of print (e.g. charters and lines) a bit darker and large areas (e.g. cell backgrounds a bit lighter). This is so that when they are side-by-side they look like the same colour. However, when printed on top of one another as per your case, you get a residual effect.

This stems from a well known effect that for any given colour, a large area of that colour will look darker than a small area of the exact same colour. There are other effects that give this illusion - such as the background and nearby colours. For an example - that is not exactly the same as yours - but illustrates the illusion, search the web for "adelson's checkerboard" and read the explanations.

In any event, the solution proposed by mpalanco (use conditional formatting of three semi-colons) is the easiest way to achieve clean result - every time, printed to paper, printed to pdf, on screen and any other form.

木格 2024-10-28 02:04:08

您正走在解决这个问题的正确道路上。您只需将字体颜色设置为白色,除非纸张不是白色,否则打印在纸张上时不会显示该值。我已经使用 Office 2007 完成了此操作。

You are on right track to resolve this. You just need to make the font color white this will not show the value when printed on paper unless the paper is not white. I have done this with Office 2007.

嗫嚅 2024-10-28 02:04:08

所以我认为为了获得您想要的效果,您需要使用宏来检查单元格的内容。 worksheet_change 事件应该可以正常工作。

为了使此代码正常运行,我需要您告诉我应隐藏其值的单元格范围,以及我们要检查值的单元格范围。

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range.Address Then
    For Each VariantValue in OtherRange
        If Range.Value = VariantValue Then
           Range.NumberFormat = ";;;"
        End If
    Next
End if
End Sub

http://www.extendoffice.com/documents/excel /919-excel-hide-cell-contents.html

http://www.ozgrid.com/VBA/run-macros-change.htm" rel="nofollow">http:// /www.ozgrid.com/VBA/run-macros-change.htm

So I think that to get the effect that you would like, you will need to use a macro to check the contents of the cell. A worksheet_change event should work well.

To get this code functional, I will need you to tell me the range of cells whose values should be hidden, and the range of cells that we are checking the values against.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range.Address Then
    For Each VariantValue in OtherRange
        If Range.Value = VariantValue Then
           Range.NumberFormat = ";;;"
        End If
    Next
End if
End Sub

http://www.extendoffice.com/documents/excel/919-excel-hide-cell-contents.html

http://www.ozgrid.com/VBA/run-macros-change.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文