Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
12
返回列表 发新帖
楼主: 1003136666

[已解决]请老师帮忙写段代码,先谢谢了

[复制链接]
发表于 2014-10-10 22:09 | 显示全部楼层
  1. Sub Macro1()
  2. Dim arr, rng As Range, i&, j%, s&, k%
  3. Application.ScreenUpdating = False
  4. For k = 1 To Sheets.Count
  5.     Sheets(k).Activate
  6.     ActiveSheet.UsedRange.Font.ColorIndex = 0
  7.     arr = [a1:ag404]
  8.     s = UBound(arr)
  9.     For j = 3 To UBound(arr, 2)
  10.         s2 = arr(s, j) / (s - 2) * 0.9
  11.         For i = 2 To UBound(arr) - 1
  12.             If Cells(i, j) < s2 Then
  13.                 If rng Is Nothing Then Set rng = Cells(i, j) Else Set rng = Union(rng, Cells(i, j))
  14.             End If
  15.         Next
  16.     Next
  17.     If Not rng Is Nothing Then rng.Font.ColorIndex = 3
  18.     Set rng = Nothing
  19. Next
  20. Application.ScreenUpdating = True
  21. End Sub
复制代码
回复

使用道具 举报

 楼主| 发表于 2014-10-11 09:05 | 显示全部楼层
dsmch 发表于 2014-10-10 22:09

谢谢老师的大气量
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-4 07:15 , Processed in 0.228447 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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