Excel精英培训网

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

[已解决]再次请教

[复制链接]
发表于 2013-6-20 13:01 | 显示全部楼层 |阅读模式
本帖最后由 ping052062 于 2013-6-20 13:02 编辑

附件里代码在实用中又有新的问题,麻烦老师们抽时间给看看。详情看附件里。
最佳答案
2013-6-20 17:21
  1. Sub aa()
  2. Dim i%, j%, k%, l%, m%, Arr, ii&
  3. Arr = [c1].CurrentRegion
  4. For ii = 1 To UBound(Arr)
  5.     i = Int(Arr(ii, 1))
  6.     j = Int(Arr(ii, 2))
  7.     If i = 0 Or j = 0 Then GoTo 100
  8.     Cells(ii, 5).Resize(1, 4).Interior.ColorIndex = 36
  9.     k = j - i + 5
  10.     If k < 5 Then k = k + 4
  11.     Cells(ii, k).Interior.ColorIndex = 5
  12.     m = 1
  13.     For l = 1 To 4 - j
  14.         If k + m > 8 Then m = m - 4
  15.         Cells(ii, k + m).Interior.ColorIndex = 3
  16.         m = m + 1
  17.     Next l
  18. 100:
  19. Next
  20. End Sub

复制代码

求其它单元格底色.zip

14.56 KB, 下载次数: 7

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2013-6-20 17:21 | 显示全部楼层    本楼为最佳答案   
  1. Sub aa()
  2. Dim i%, j%, k%, l%, m%, Arr, ii&
  3. Arr = [c1].CurrentRegion
  4. For ii = 1 To UBound(Arr)
  5.     i = Int(Arr(ii, 1))
  6.     j = Int(Arr(ii, 2))
  7.     If i = 0 Or j = 0 Then GoTo 100
  8.     Cells(ii, 5).Resize(1, 4).Interior.ColorIndex = 36
  9.     k = j - i + 5
  10.     If k < 5 Then k = k + 4
  11.     Cells(ii, k).Interior.ColorIndex = 5
  12.     m = 1
  13.     For l = 1 To 4 - j
  14.         If k + m > 8 Then m = m - 4
  15.         Cells(ii, k + m).Interior.ColorIndex = 3
  16.         m = m + 1
  17.     Next l
  18. 100:
  19. Next
  20. End Sub

复制代码

求其它单元格底色0620.rar

14.43 KB, 下载次数: 3

回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 05:44 , Processed in 0.278678 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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