![]() |
Textbox Formatting Trouble
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 |
Textbox Formatting Trouble
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 |
Textbox Formatting Trouble
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 "DaveO" wrote: 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 |
Textbox Formatting Trouble
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. "ETLahrs" wrote: 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 "DaveO" wrote: 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 |
All times are GMT +1. The time now is 06:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com