【发布时间】:2019-07-10 10:56:46
【问题描述】:
我正在创建一个 Excel 用户表单。我想验证两个文本框值。
if combobox1.text= 1 to 2yr then textbox2.value =>1 and <=2
combobox11.text= 3 to 10yr then textbox2.value =>3 and <=10
combobox1.text= 11 to 15yr then textbox2.value =>11 and <=15
combobox1.text= 16 to 20yr then textbox2.value =>16 and <=20
end if
【问题讨论】:
-
嗨,您的语法看起来有问题……但为了帮助解决问题,最好澄清您要达到的目标。您是否希望根据
textbox1.text设置textbox2.value? ...或者您是否尝试验证两个文本框并执行其他操作?textbox1中是否输入了一个数字?谢谢 -
如果年龄组文本是 1 到 2 岁,那么年龄必须在 1 到 2 之间,如果值更大或更小,则显示消息“请输入正确的值”
-
使用 KeyDown 事件可以更好地进行验证。