Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I remove blank spaces from fields nozzaworld Excel Discussion (Misc queries) 6 February 22nd 10 02:34 PM
How do I autofill spaces in right justified fields? Bob_Balch Excel Discussion (Misc queries) 1 July 18th 08 04:42 AM
Custom Fields with spaces [email protected] Excel Discussion (Misc queries) 15 July 16th 07 10:09 AM
Using FormulaR1C1 to find fields begining with spaces poppy Excel Programming 3 July 5th 06 11:53 AM
Add spaces for specific fields to paste in Corey Excel Discussion (Misc queries) 3 December 30th 05 10:22 PM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"