如何编写我的excel文件上的文本框,使其只接受正整数? [英] How do I program the text box that I have on my excel file such that it accepts only positive integers?

查看:104
本文介绍了如何编写我的excel文件上的文本框,使其只接受正整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文本框不在用户表单中。它只是放在工作表上。我打算让文本框只接受正整数值,从那时起就失败了。



我尝试过:



我曾尝试使用KeyPress(ByVal KeyAscii As MSForm.ReturnInteger)事件,但无济于事。我开始怀疑上面提到的事件是否仅适用于在vba中使用Userforms。任何人都可以告诉我这个我坚持的错误吗?

The text box is not on a User form. It is just placed on the worksheet. My intention to have the text box accept only the positive Integer values has failed ever since.

What I have tried:

I have tried to use the KeyPress(ByVal KeyAscii As MSForm.ReturnInteger) event but to no avail. I begin to wonder if the the above mentioned event is applicable only in using Userforms in vba. Can anyone enlighten me on this bug that im stuck with please?

推荐答案

强迫它是积极的:



MS Excel:如何使用ABS功能(WS,VBA) [ ^ ]
"Force it" to be positive:

MS Excel: How to use the ABS Function (WS, VBA)[^]


这篇关于如何编写我的excel文件上的文本框,使其只接受正整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆