简体   繁体   中英

Display number 0 in excel cell

I'm using a userform to add numbers in my excel sheet.

When someone add 01234 in the userform, I only see 1234 in the excel cell.

So I modified the cell format, it worked but whenever i wanted to only add 1234 , excel would display a 0 so 01234 .

I just want to be able to add the textbox value as it is in excel sheets.

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)

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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