gpt4 book ai didi

excel - 加粗的前 50% 的总和值和值 => 50,000

转载 作者:行者123 更新时间:2023-12-04 20:26:35 25 4
gpt4 key购买 nike

Sub Highlight_Top50_AND_50K()
Dim CheckRange As Range
With ActiveSheet
Set CheckRange = .Range("E2:E" & .Cells(.Rows.Count, "E").End(xlUp).Row)
End With

With CheckRange
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=0.5*SUM(E:E)", Formula2:="=50,000"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1)
.Font.Bold = True
.StopIfTrue = False
End With
End With
End Sub

在范围内 (E2:E),

条件 1: 的粗体值大于等于总和值的 50% .

条件 2: 的粗体值大于等于 50,000 .

代码运行没有错误,但没有生成任何内容。有人可以启发我吗?

最佳答案

测试下面的代码,看看它是否适合你。您发布的代码仅添加了一个条件,而不是您声明的两个条件!

With CheckRange
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="50000"
With .FormatConditions(1)
.Font.Bold = True
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=0.5*SUM(E:E)"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1)
.Font.Bold = True
.StopIfTrue = False
End With
End With

关于excel - 加粗的前 50% 的总和值和值 => 50,000,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59044872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com