当前位置: 代码迷 >> VBA >> 请问一个excel代码有关问题
  详细解决方案

请问一个excel代码有关问题

热度:8023   发布时间:2013-02-26 00:00:00.0
请教一个excel代码问题
我现在有一个表,H,O,Q列

H             O               Q

T           20      

F           40

现在我想如果判断当a列的某个单元格为 "T "   ,   b的同行单元格 <30,   显示“过期”

断当a列的某个单元格为 "F "   ,   b的同行单元格> 30,   显示“在保修期中”

小弟我嵌套的条件没学好,不知道怎么用

Sub   color()
Dim   index   As   Integer  
Dim   strRangeO   As   String  
Dim   strCol   As   String
Dim   strrangeQ   As   String
Dim   strRangeN   As   String
Dim   strRangeH   As   String
                For   index   =   3   To   1000
                        strrangeQ   =   "q "   +   CStr(index)
                        strRangeO   =   "o "   +   CStr(index)
                        strRganeH   =   "h "   +   CStr(index)
                        strIndex   =   CStr(index)   +   ": "   +   CStr(index)

ElseIf   (Range(strRangeO).Value   >   30)   And   (Range(strRangeH).Value   =   f)   Then
                        Range(strrangeQ).Value   =   "在保修期中 "
                        Rows(strIndex).Select
                        With   Selection.Interior
                                .ColorIndex   =   3
                                .Pattern   =   xlSolid
                                  Selection.Font.ColorIndex   =   1

这个提示       方法range作用于对象 '_global '失败。。。求教


------解决方案--------------------------------------------------------
http://community.csdn.net/Expert/topic/5368/5368255.xml?temp=.6700556
  相关解决方案