gpt4 book ai didi

excel - 根据公式值格式化单元格

转载 作者:行者123 更新时间:2023-12-04 22:07:46 25 4
gpt4 key购买 nike

我有带有数据的单元格Peer(3)
我得到 VALUE(LEFT(RIGHT(F2,2))) 的号码

然后我想给单元格一个我正在尝试但不工作的颜色我得到类型不匹配,已经尝试了几个小时并且没有得到任何地方。

谢谢

Sub Format()

Dim LastRow As Long
Dim WS As Worksheet

Set WS = Sheets("sheet1")

LastRow = WS.range("F" & WS.Rows.Count).End(xlUp).Row

If WS.range("F2:F" & LastRow).Formula = "=Value(Left(Right(F2, 2)))" < 3 Then cell.Interior.ColorIndex = 10

End Sub

最佳答案

也许

Sub Format()

Dim LastRow As Long
Dim WS As Worksheet
dim rCell as range

Set WS = Sheets("sheet1")

LastRow = WS.range("F" & WS.Rows.Count).End(xlUp).Row

for each rcell in WS.range("F2:F" & LastRow).cells
if clng(Left(Right(rcell.value, 2), 1)) < 3 Then rcell.Interior.ColorIndex = 10
next rcell
End Sub

关于excel - 根据公式值格式化单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16904332/

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