Excel精英培训网

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

[已解决]再按大中小填色请老师帮忙

[复制链接]
发表于 2016-8-3 13:08 | 显示全部楼层 |阅读模式
按大中小数填色.rar (124.67 KB, 下载次数: 12)
发表于 2016-8-3 13:33 | 显示全部楼层
附件 如果满意请给最佳
Sub xx()
Set rng = Range("L4:AE22")
For Each cell In rng
If cell >= 0 And cell <= 2 Then
cell.Interior.ColorIndex = 3
ElseIf cell >= 3 And cell <= 6 Then
cell.Interior.ColorIndex = 4
ElseIf cell >= 7 And cell <= 9 Then
cell.Interior.ColorIndex = 5
End If
Next
End Sub

按大中小数填色.rar

123.81 KB, 下载次数: 3

回复

使用道具 举报

 楼主| 发表于 2016-8-3 14:17 | 显示全部楼层
这样不能下拉,想用条件格式就好,这样有点复杂,先感谢老师,想老师再用条件格式写下谢谢
回复

使用道具 举报

发表于 2016-8-3 14:37 | 显示全部楼层
Sub color()
Dim i As Long
Dim j As Long
For i = 4 To 22
    For j = 12 To 31
        If Cells(i, j) >= 0 And Cells(i, j) <= 2 Then
        Cells(i, j).Interior.ColorIndex = 3
        Else
            If Cells(i, j) >= 3 And Cells(i, j) <= 6 Then
            Cells(i, j).Interior.ColorIndex = 4
            Else
                If Cells(i, j) >= 7 And Cells(i, j) <= 9 Then
                Cells(i, j).Interior.ColorIndex = 5
                End If
            End If
        End If
    Next
Next
回复

使用道具 举报

发表于 2016-8-3 14:38 | 显示全部楼层
Sub color()
Dim i As Long
Dim j As Long
For i = 4 To 22
    For j = 12 To 31
        If Cells(i, j) >= 0 And Cells(i, j) <= 2 Then
        Cells(i, j).Interior.ColorIndex = 3
        Else
            If Cells(i, j) >= 3 And Cells(i, j) <= 6 Then
            Cells(i, j).Interior.ColorIndex = 4
            Else
                If Cells(i, j) >= 7 And Cells(i, j) <= 9 Then
                Cells(i, j).Interior.ColorIndex = 5
                End If
            End If
        End If
    Next
Next
End Sub
回复

使用道具 举报

发表于 2016-8-3 15:42 | 显示全部楼层    本楼为最佳答案   
czh0066 发表于 2016-8-3 14:17
这样不能下拉,想用条件格式就好,这样有点复杂,先感谢老师,想老师再用条件格式写下谢谢

你的意思是不要限制行数对吧?改完了 你再试试

按大中小数填色.rar

122.67 KB, 下载次数: 1

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-28 03:58 , Processed in 0.258086 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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