Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1383|回复: 0

小白求解,Interior.ColorIndex失效求助

[复制链接]
发表于 2017-12-21 23:31 | 显示全部楼层 |阅读模式
Sub x()
Dim k, i, r, x, y, arr
Set r = Range(Cells(3, 2), Cells(Range("a1").End(xlDown).Row - 5, Range("a1").End(xlToRight).Column))
arr = r
i = InputBox("请输入大于多少金额", "请输入金额", 1000)
k = WorksheetFunction.CountIf(r, ">" & i)
For x = 1 To UBound(arr, 1)
    For y = 1 To UBound(arr, 2)
        If arr(x, y) >= i Then
            Cells(x + 2, y + 1).Interior.ColorIndex = 3
        End If
    Next y
Next x
MsgBox "大于" & i & "的单量有" & k
End Sub

循环内 Interior.ColorIndex 失效 不上色 程序直接 另Cells(x + 2, y + 1).Interior.ColorIndex = 3 下加入stop   也是失效的 程序直接跑完

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-19 04:21 , Processed in 0.194976 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表