简体   繁体   English

在excel单元格中显示数字0

[英]Display number 0 in excel cell

I'm using a userform to add numbers in my excel sheet.我正在使用用户表单在我的 Excel 工作表中添加数字。

When someone add 01234 in the userform, I only see 1234 in the excel cell.当有人在用户01234中添加01234时,我只在 excel 单元格中看到1234

So I modified the cell format, it worked but whenever i wanted to only add 1234 , excel would display a 0 so 01234 .所以我修改了单元格格式,它起作用了,但是每当我只想添加1234 ,excel 会显示 0 所以01234

I just want to be able to add the textbox value as it is in excel sheets.我只想能够添加文本框值,因为它在 Excel 工作表中。

Thank you谢谢

EDIT:编辑:

This is a part of the code that takes the textbox value and enters in the requested cell :这是获取文本框值并输入请求的单元格的代码的一部分:

Sheets("Sheet3").Range("B4").Select
ActiveCell.Value = UCase(TextBox2)

Prefix zero-prefixed entries with ' (single quote), no prefix for non-zero prefixed entries?用 '(单引号)前缀零前缀条目,非零前缀条目没有前缀?

A
1'01234
2 1234

=A1+A2->2468 (OK) =A1+A2->2468(好)

Since you say (in comments) that you don't mind if the resultant cell value is numeric or text, simply use由于您说(在评论中)您不介意结果单元格值是数字还是文本,只需使用

Worksheets("Sheet3").Range("B4").Value = "'" & UCase(TextBox2)

This will make all entries text.这将使所有条目成为文本。 FWIW, that may become an issue for you later! FWIW,这可能会成为你以后的问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM