【发布时间】:2015-08-03 12:08:48
【问题描述】:
我有这张桌子:
ID CODE NAME Percentage unit sales
6494 Orange 0% 2 74.00
582 apple 0% 1 90.00
SubTotal 1% 3 164.00
6493 Banana 171% 951 25,677.00
6494 Strawberry 33% 182 6,734.00
SubTotal 204% 1133 32,411.00
Grand Total 205% 1136 32,575.00
我想突出显示所有单元格,直到最后一列包含单词“TOTAL”。
此代码仅突出显示包含“总计”的单元格。如何突出显示整行?
MySearch = Array("Total")
myColor = Array("3")
For Each sh In ActiveWorkbook.Worksheets
With sh.Cells
.Interior.ColorIndex = xlColorIndexNone
For I = LBound(MySearch) To UBound(MySearch)
Set Rng = .Find(What:=MySearch, After:=ActiveSheet.Range("J8"), LookIn:=xlValues, MatchCase:=False)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
Rng.Interior.ColorIndex = myColor(I)
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
End If
Next I
End With
Next sh
【问题讨论】:
-
请修正小计/总计的格式,以便更清楚地了解数据
-
给你,我希望你能帮助我:)