[英]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.