|
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim r As Long
- r = Me.Cells(Rows.Count, 1).End(xlUp).Row
- zihao = 10
- If Target.Row = 1 Then
- zihao = Target.Offset(1, 0).Font.Size
- If Target.Offset(1, 0).Font.Color = RGB(255, 0, 0) Then zihao = zihao - 1
- Else
- zihao = Target.Font.Size
- If Target.Font.Color = RGB(255, 0, 0) Then zihao = zihao = zihao - 1
- End If
- If Target.Row = 1 Then
- With Me.Range("A2:H" & r)
- .Font.Bold = False
- .Font.Color = RGB(0, 0, 0)
- .Font.Size = zihao
- End With
- Exit Sub ' 当点击第一行时,直接退出子程序,不执行后续操作
- End If
- If Not Intersect(Target, Me.Range("A2:H" & r)) Is Nothing Then
- With Me.Range("A2:H" & r)
- .Font.Bold = False
- .Font.Color = RGB(0, 0, 0)
- .Font.Size = zihao
- End With
- With Target.EntireRow
- .Resize(1, 8).Font.Bold = True ' 粗体
- .Resize(1, 8).Font.Color = RGB(255, 0, 0) ' 红色字体
- .Resize(1, 8).Font.Size = zihao + 1
- End With
- End If
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|