excel - 仅当某个单元格已填充时才填充单元格
问题描述
我知道如何使用数据验证来做到这一点,但我想添加一个参数。
我希望数据验证公式仅在“A109”=“test1”或“test2”时运行。
我在下面尝试了这个,但它没有给我想要的东西。无论如何,数据验证公式都在运行。
Sub Macro2()
If Range("A109").Value = "Test1" Or "Test2" Then
Range("B111").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=NOT(ISBLANK(B109))"
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "ATTENTION!"
.InputMessage = ""
.ErrorMessage = _
"Vous ne pouvez faire la remise en service tant que vous n'avez pas approuvé le ""...."" ou ""...."" à la cellule B109."
.ShowInput = True
.ShowError = True
End With
Sheets("Grille").Select
Else
Stop
End If
End Sub
解决方案
推荐阅读
- java - MySql 正在记录我的更新查询,但实际上并没有执行更新
- javascript - 调用嵌套函数 onClick 事件不识别嵌套函数
- f# - F#:获取源文件以自动评估
- visual-studio - 将查询更改为 SSRS 中的表达式
- python - 通过 uber/petastorm 将 ndarray 存储到 Parquet 中?
- c - 如何让 gdb 显示关于函数头部的行号?
- css - 为什么谷歌字体显示两种不同的方式
- websocket - webpack 中的代理 wss
- hadoop - HDP 3.1.0.0-78 升级后无法使用 ResourceManager UI 杀死 YARN 应用程序
- python-3.x - 导入整个 python 文件的文件夹