![]() |
Format a result
Hi
I'm concatenating several cells into one cell. I need the one value to display a total of 12 characters long. However, teh cell value may consist of anywhere from 4 - 12 digits. How can I get the results to display in a cell to be left aligned, with any unused characters to be displayed as "spaces" to the right of the digits? (123456789 ) I've tried format(AcctNum, "000000000000"), but it shows all 12 characters as a number or a zero. (000123456789) If I use format(AcctNum, "############"), it only shows the characters used, and no extra characters are entered. If the AcctNum is only 6 characters long, only 6 characters are used, and I need 12 characters. (123456789) If I use format(AcctNum, " "), it only enters in 12 spaces, nothing else. ( ) Thank you. Fred |
Format a result
Try it this way...
Format(AcctNum, "!@@@@@@@@@@@@") Rick "Fred" wrote in message ... Hi I'm concatenating several cells into one cell. I need the one value to display a total of 12 characters long. However, teh cell value may consist of anywhere from 4 - 12 digits. How can I get the results to display in a cell to be left aligned, with any unused characters to be displayed as "spaces" to the right of the digits? (123456789 ) I've tried format(AcctNum, "000000000000"), but it shows all 12 characters as a number or a zero. (000123456789) If I use format(AcctNum, "############"), it only shows the characters used, and no extra characters are entered. If the AcctNum is only 6 characters long, only 6 characters are used, and I need 12 characters. (123456789) If I use format(AcctNum, " "), it only enters in 12 spaces, nothing else. ( ) Thank you. Fred |
Format a result
Dim AcctNum As Long
AcctNum = 1234 MsgBox "**" & Left(AcctNum & Space(12), 12) & "**" Fred wrote: Hi I'm concatenating several cells into one cell. I need the one value to display a total of 12 characters long. However, teh cell value may consist of anywhere from 4 - 12 digits. How can I get the results to display in a cell to be left aligned, with any unused characters to be displayed as "spaces" to the right of the digits? (123456789 ) I've tried format(AcctNum, "000000000000"), but it shows all 12 characters as a number or a zero. (000123456789) If I use format(AcctNum, "############"), it only shows the characters used, and no extra characters are entered. If the AcctNum is only 6 characters long, only 6 characters are used, and I need 12 characters. (123456789) If I use format(AcctNum, " "), it only enters in 12 spaces, nothing else. ( ) Thank you. Fred -- Dave Peterson |
All times are GMT +1. The time now is 10:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com