将B2:B101中大于500的数值用红色显示出来。
用循环找出>500的数值后再加粗和红色设置。
sub 高亮()
for i = 2 to 101
if cells(i,2).value > 500 then
cells(i,2).select
selection.font.bold=True '粗体
selection.font.colorindex = 3 '红色字体
end if
Next
end sub
转载于:https://blog.51cto.com/11729955/2325236