Sub a()Sub a() Range("A1").Select For i =0To56Step1 ActiveCell.Interior.ColorIndex = i ActiveCell.Offset(0, 1).Value2 = i If i Mod19=18And i <>0Then ActiveCell.Offset(-18, 2).Select Else ActiveCell.Offset(1, 0).Select EndIf Next End Sub
使用如下VBA代码取得相应的单元格底色Sub a()Sub a() Range("A1").Select For i = 0 To 56 Step 1 ActiveCell.Interior.ColorIndex = i ActiveCell.Offset(0, 1).Value2 = i If i Mod 19 = 18 And i