Textbox Formatting Trouble

E

ETLahrs

I am using a userform in which 1 of the textboxes contains a 16 digit account
number. When the user seaches for the information after entering it in, the
account number returns as 1.23456789...E+15. The cells in which it is stored
is formatted as number with 0 decimal places. Also, when the account number
is originally entered, it is entered as 16 digits.

How can I format the textbox to just show the number, no E+15, no commas, or
currency?

Thanks,
Ed
 
D

DaveO

This is a little chunky but I got it to work.

I entered a long decimal string in a cell, preceded by an apostrophe
to prevent Excel form autoformatting into an E+ representation. (It
also works if the cell is formatted as Text and the numeric characters
entered with no apostrophe.) Then in a code window I declared a public
variable K as string, and wrote this code to assign the account number
to K and open a Userform:

Sub test()
Dim Z As Byte

K = ActiveCell.Value
UserForm1.Show

End Sub


The Userform_Activate code assigns the value of K to the textbox. Can
you use this?

Dave O
Eschew obfuscation
 
E

ETLahrs

There seems to be something wrong with the formatting of the cells. I tried
changing the format of the cells to be text, but in the cell it entered with
the E+. Also, I have noticed that it is dropping the last number of the
account and replacing it with a zero. I tried deleting the column and then
inserting a new column (so that I didn't have the change the range in all my
code) and then formatting the cells, that didn't work either. I may have to
try assigning the account # to a different column, it's just very odd.

Thanks
 
E

ETLahrs

Update:

I deleted every column after my data to the end of the spreadsheet, column
IV and then formatted my column as text and now it seems to work fine.
Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top