开发者

Setting a range to "False" and changing the color of cells based on value

I have an old Excel application that someone made, and I am wondering what this does:

Range("AF6") = "FALSE"

Edit: I discovered that it sets the 开发者_如何学编程cell to False. This changes the color of another cell, how does it do that?


This is VBA short-form for setting the value of a range of cells (or in this case, a single cell). So the example you've provided will actually insert the text value "FALSE" into cell AF6.

If the colour of the other cell is not being set in code, then I would suggest it was done through conditional formatting.


The other cell will have a condition along the lines of (in pseudocode):

if (Range(AF6) = "FALSE") then
    thisCell.Background = colour
endif

Been a while since I've done VBA, so not sure of the exact syntax, but that is essentially what will be happening. Might be worth finding out the 'business' logic for the cell's colour changing - will help to clarify it for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜