|
3#
楼主 |
发表于 2015-12-21 10:26:35
|
只看该作者
你好,谢谢您帮忙。已解决了我的问题。
不过,我将行号改为动态的后,需要加一个IF条件,否则空白的单元格也会出现黄色的底纹- Sub test()
- Dim rng As Range
- 'rng.Cells.Interior.Color
- Dim i As Long, r As Integer
- Dim j As Long
- r = [a65536].End(xlUp).Row
- Cells.ClearFormats
- For i = 1 To r
- j = i Mod 4
- With Sheets(1).Range("A2:H2").Offset(i, 0)
- If Cells(i + 2, 1) <> "" Then
- Select Case j
- Case Is = 1
- .Font.Color = vbRed
- Case Is = 2
- .Font.Bold = True
- .Font.Name = "隶书"
- Case Is = 3
- .Font.Italic = True
- Case Is = 0
- .Interior.Color = vbYellow
- End Select
- End If
- End With
- Next
- End Sub
复制代码 |
|