Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Fields with spaces
Hi,
The easiest way to explain my dilemma is by example. I need a custom field that is always thirty character spaces long no matter how long the text is. So for example, lets say the word is PIZZA which is 5 characters, I would need 25 blank spaces afterwards to get to 30 characters in total. Does anybody know what this would look like? I've tried to use the _ but that doesn't seem to work. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Fields with spaces
Try something like this...
Sub PadText() Dim str As String str = "Pizza" MsgBox str & "!" str = str & Space(30 - Len(str)) MsgBox str & "!" End Sub -- HTH... Jim Thomlinson " wrote: Hi, The easiest way to explain my dilemma is by example. I need a custom field that is always thirty character spaces long no matter how long the text is. So for example, lets say the word is PIZZA which is 5 characters, I would need 25 blank spaces afterwards to get to 30 characters in total. Does anybody know what this would look like? I've tried to use the _ but that doesn't seem to work. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Fields with spaces
If your data is in Cell A1 then...
=LEFT(A1,30)&REPT(" ",30-LEN(LEFT(A1,30))) -- HTH, Gary Brown If this post was helpful to you, please select ''''''''''''''''YES'''''''''''''''' at the bottom of the post. " wrote: Hi, The easiest way to explain my dilemma is by example. I need a custom field that is always thirty character spaces long no matter how long the text is. So for example, lets say the word is PIZZA which is 5 characters, I would need 25 blank spaces afterwards to get to 30 characters in total. Does anybody know what this would look like? I've tried to use the _ but that doesn't seem to work. Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Fields with spaces
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Custom Fields with spaces
On Jul 13, 12:06 pm, Gary Brown
wrote: If your data is in Cell A1 then... =LEFT(A1,30)&REPT(" ",30-LEN(LEFT(A1,30))) -- HTH, Gary Brown If this post was helpful to you, please select ''''''''''''''''YES'''''''''''''''' at the bottom of the post. " wrote: Hi, The easiest way to explain my dilemma is by example. I need a custom field that is always thirty character spaces long no matter how long the text is. So for example, lets say the word is PIZZA which is 5 characters, I would need 25 blank spaces afterwards to get to 30 characters in total. Does anybody know what this would look like? I've tried to use the _ but that doesn't seem to work. Thanks.- Hide quoted text - - Show quoted text - Got it thanks for all the help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I remove blank spaces from fields | Excel Discussion (Misc queries) | |||
How do I autofill spaces in right justified fields? | Excel Discussion (Misc queries) | |||
Custom Fields with spaces | Excel Discussion (Misc queries) | |||
Using FormulaR1C1 to find fields begining with spaces | Excel Programming | |||
Add spaces for specific fields to paste in | Excel Discussion (Misc queries) |