[VBA ] IF 用法

楼主: s881718 (我要找除念师)   2017-12-29 16:37:39
我想用如果字体是黄色 另一个储存格变2,却没跑出,我想请问大家这是为什么
以下是程式码
If Cells(3, 9).Font.Color = -16711681 And Cells(3, 9).Font.TintAndShade = 0
Then Cells(3, 10) = 2
作者: manforwan (QQ)   2017-12-29 18:47:00
endif
作者: napyang (爱唱歌的大男孩)   2017-12-29 19:09:00
打在同一行的话end if可以省略喔!试试看把and后面的条件砍掉吧,可能被这个条件影响了(或者你的颜色码是错的
作者: vincent0926   2017-12-29 21:48:00
也要注意if写在什么事件,例如当工作簿储存格发生的改变时执行
作者: notsag (a+)   2017-12-30 21:17:00
Debug.Print Cells(3,9).Font.Color 会得65535https://goo.gl/YCmQ13

Links booklink

Contact Us: admin [ a t ] ucptt.com