Hi.
Does anyone know how to set the format of a cell such that it will automatically add trailing blanks to the data entered into that cell while fixing the number of characters that could be entered into that cell?
Thanks.
Friend
Hi.
Does anyone know how to set the format of a cell such that it will automatically add trailing blanks to the data entered into that cell while fixing the number of characters that could be entered into that cell?
Thanks.
Friend
Last edited by friend11_6; 07-14-2009 at 11:47 AM.
Not sure about the trailing spaces, but to control length use Data Validation, Text Length option.
There are several ways to achieve this.. one way is by formula..
Assuming that if the length of text is less than 8 then you want space to make the length 8 you can use the below formula
Enter the below formula
After applying the formula you can do copy -> paste special -> values..![]()
Please Login or Register to view this content.
Shijesh Kumar
http://shijesh.wordpress.com/
You can't alter the physical content of a cell using a Custom Format - you can alter it's appearance however, ie:
@*.
would "appear" to fill up the remainder of a cell up with full stops though underlying value remains just the initial text (the . would print however).
If you want to physically alter the content of the cell you would need to use either a formula to correct in another cell or a VBA change event to alter the cell upon entry... so say you wanted A1:A10 to be a max of 8 characters with surplus characters filled with a space:
As Palmetto has said you could use Data Validation to restrict length but given you need to alter the value with VBA you may as well validate there also - Validation can on occasion be circumvented (copy & paste etc...)![]()
Please Login or Register to view this content.
Last edited by DonkeyOte; 07-09-2009 at 10:01 AM.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks