怎样使用VBA对区域中最大值添加下划线?

时间:2024-10-12 11:50:00

1、首先在开发工具中打开VBA编辑器

怎样使用VBA对区域中最大值添加下划线?

2、在单元格区域当中输入一些内容作为例子

怎样使用VBA对区域中最大值添加下划线?

3、在VBA编辑器中插入模块

怎样使用VBA对区域中最大值添加下划线?

4、在模块当中输入如下代码,然后运行Sub 添加条件格式() Cells.FormatConditions.Delete Dim rng As Range Set rng=Application.Intersect(Range("a:a"), ActiveSheet.UsedRange.Offset(2, 0), ActiveSheet.UsedRange) With rng .Select .FormatConditions.Add Type:=xlExpression, Formula1:=_ "=OFFSET(A3,,4)=MAX($E:$E)" .FormatConditions(.FormatConditions.Count).SetFirstPriority With .FormatConditions(1).Font .Underline=xlUnderlineStyleSingle .TintAndShade=0 End With .FormatConditions(1).StopIfTrue=False End WithEnd Sub

怎样使用VBA对区域中最大值添加下划线?

5、使用快捷键Alt+F8调出运行宏窗口,然后单击“执行”按钮,可以看到最高分者“田伯光”姓名下已添加下划线

怎样使用VBA对区域中最大值添加下划线?
© 手抄报圈