简体   繁体   English

如何基于工作表中的单元格更改选项卡颜色?

[英]How to change the tab color based on a cell in the worksheet?

I have a very large spreadsheet with lots of worksheets that I use to create invoices based on a project number. 我有一个非常大的电子表格,其中包含许多工作表,可用于基于项目编号创建发票。 Each project doesn't get billed on a monthly basis. 每个项目都不按月计费。 I have to print each invoice to PDF and to avoid having to open every tab to see if there is information to bill, I'd like to change the tab color based a cell which contains the total of the invoice. 我必须将每个发票打印为PDF,并且避免打开每个标签以查看是否有要开票的信息,我想基于包含发票总数的单元格更改标签颜色。

I have used VBA very little but have found several macros that are trying to do the same thing but because they rely on something different, I can't get what I need. 我很少使用VBA,但是发现了几个试图做同一件事的宏,但是由于它们依赖于不同的东西,所以我无法获得所需的东西。 I found one that just turns all the tabs a color. 我发现一个可以使所有标签变成一种颜色的标签。 I found one that changes the color based on a true/false formula. 我发现一个可以根据对/错公式更改颜色的方法。 I don't have the knowledge around this code to change it so that if cell H22 is >0, it turns the tab a color. 我没有关于此代码的知识,无法对其进行更改,因此如果单元格H22> 0,它将使制表符变为一种颜色。

The invoices created before I took my role aren't consistent so not all totals will be in cell H22 -- it could be H14. 在担任我的职务之前创建的发票不一致,因此并非所有总计都在单元格H22中-可能是H14。 I'm even willing to put a button on each tab that I could press to apply the macro as I do my preliminary work on each tab. 我甚至愿意在每个选项卡上放置一个按钮,以便在我对每个选项卡进行初步工作时可以按一下以应用宏。 I just don't have the knowledge good enough to know how to write the code. 我只是没有足够的知识来知道如何编写代码。 Thanks! 谢谢!

The easiest way would be to find an cell that none of the worksheets use (say AZ99) and do the equivalent of the H22>0 example you described on each sheet. 最简单的方法是找到一个工作表都不使用的单元格(例如AZ99),并等效于您在每个工作表上描述的H22> 0示例。

eg sheet1 might have AZ99 as X10>0, sheet2 might be Y11>0 or whatever. 例如,sheet1的AZ99可能为X10> 0,sheet2的Y11> 0或其他值。

Use the true/false VBA code to look at cell AZ99 or whatever the cell you choose is. 使用true / false VBA代码查看单元格AZ99或所选的单元格。

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

相关问题 Excel宏-如何根据同一工作簿中单独工作表中的单元格更改选项卡颜色? - Excel Macro - How to change tab color based on cell in a separate worksheet in same workbook? 如何基于该工作表上的单元格值更改选项卡的颜色 - How to change the color of a tab based on cell value on that sheet VBA-如何根据公式/单元格值更改标签颜色(跨多个标签) - VBA - how to change tab color (across multiple tabs) based on formula/cell value 如何根据值更改单元格颜色 - How to make cell color change based on value 如何通过VBA根据其他单元格值更改单元格的背景颜色 - How to change background color of cell based on other cell value by VBA 如果选中此复选框,则在下一个工作表上更改单元格的单元格颜色 - Change cell color of cell on next worksheet if checkbox is checked 如果单元格范围包含文本,则更改工作表标签的颜色 - Change worksheet tab color if range of cells contains text 根据单元格颜色更改Excel中单元格的值 - Change the value of a cell in Excel based on cell color 根据其他单元格值更改单元格颜色 - Change cell color based on another cell value 如何使用FormatConditions根据单元格值与其他单元格的比较来更改单元格颜色? - How to use FormatConditions to change the cell color based on the compare of cell value with other cell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM