Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Setting spaces between text in a cell

Can someone please tell me how to set a certain amount of spaces between text
in a given cell? Here is what I have:

A1
Market Description
Tucson,AZ

What I want is:

A1
Market Descripton Tucson,AZ

All of the information is in cell A1. What I would also like to do after
setting the amount of spaces between each text, is move the second category
to the next cell so it will look like this:

A1 A2 A3
Market Description Tucson,AZ

Maybe I could skip the "spaces" issue and just figure out a way to take
whatever text is set more than 2 spaces and move it to the next cell? Any
answers?


--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Setting spaces between text in a cell

Hi Erik,

With the text cells selected, try:

Data | Text to columns | Delimited | Next | Check the 'Space' option |
Next | Finish.

To remove leading or trailing spaces, use Excel's Trim function.


---
Regards,
Norman



"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:56d93682c0ce1@uwe...
Can someone please tell me how to set a certain amount of spaces between
text
in a given cell? Here is what I have:

A1
Market Description
Tucson,AZ

What I want is:

A1
Market Descripton Tucson,AZ

All of the information is in cell A1. What I would also like to do after
setting the amount of spaces between each text, is move the second
category
to the next cell so it will look like this:

A1 A2 A3
Market Description Tucson,AZ

Maybe I could skip the "spaces" issue and just figure out a way to take
whatever text is set more than 2 spaces and move it to the next cell?
Any
answers?


--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Setting spaces between text in a cell

Does the question mean that if there is just one space you don't want to
split it? If not, you could use DataText To Columns delimited by space.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:56d93682c0ce1@uwe...
Can someone please tell me how to set a certain amount of spaces between

text
in a given cell? Here is what I have:

A1
Market Description
Tucson,AZ

What I want is:

A1
Market Descripton Tucson,AZ

All of the information is in cell A1. What I would also like to do after
setting the amount of spaces between each text, is move the second

category
to the next cell so it will look like this:

A1 A2 A3
Market Description Tucson,AZ

Maybe I could skip the "spaces" issue and just figure out a way to take
whatever text is set more than 2 spaces and move it to the next cell?

Any
answers?


--
Message posted via http://www.officekb.com



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Setting spaces between text in a cell

Yes, if there is only one space I do not want to move it to another cell nor
delete the space. Any suggestions?

Bob Phillips wrote:
Does the question mean that if there is just one space you don't want to
split it? If not, you could use DataText To Columns delimited by space.

Can someone please tell me how to set a certain amount of spaces between text
in a given cell? Here is what I have:

[quoted text clipped - 18 lines]
whatever text is set more than 2 spaces and move it to the next cell? Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Setting spaces between text in a cell

Norman,

How do I write this in a VBA macro?

Norman Jones wrote:
Hi Erik,

With the text cells selected, try:

Data | Text to columns | Delimited | Next | Check the 'Space' option |
Next | Finish.

To remove leading or trailing spaces, use Excel's Trim function.

---
Regards,
Norman

Can someone please tell me how to set a certain amount of spaces between
text

[quoted text clipped - 21 lines]
Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Setting spaces between text in a cell

Hi Erik,

How do I write this in a VBA macro?


Turn on the macro recorder while you perform the operation manually. This
will provide you with base code which can be edited to render it suitable
for general application.

However, I note from your response to Bob, that you wish to distinguish
between single and multiple spaces.With the text selected, perform a
Search/Replace, replacing double spaces with a character such as # (hash).

Then perform the Text To Columns operation as before, this time un-checking
space and inserting the hash character in the 'Other' delimiter box.

Change double space to treble space or whatever is appropriate to your
circumstances.


---
Regards,
Norman



"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:56d9b5c70904d@uwe...
Norman,

How do I write this in a VBA macro?

Norman Jones wrote:
Hi Erik,

With the text cells selected, try:

Data | Text to columns | Delimited | Next | Check the 'Space' option |
Next | Finish.

To remove leading or trailing spaces, use Excel's Trim function.

---
Regards,
Norman

Can someone please tell me how to set a certain amount of spaces between
text

[quoted text clipped - 21 lines]
Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Setting spaces between text in a cell

Where/how do I put the :

Data | Text to columns | Delimited | Next | Check the 'Space' option |
Next | Finish information?

Erik K wrote:
Norman,

How do I write this in a VBA macro?

Hi Erik,

[quoted text clipped - 14 lines]
Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Setting spaces between text in a cell

Geez!

Nevermind that question. Ever feel stupid? lol

Erik K wrote:
Where/how do I put the :

Data | Text to columns | Delimited | Next | Check the 'Space' option |
Next | Finish information?

Norman,

[quoted text clipped - 5 lines]
Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Setting spaces between text in a cell

Here is a macro

Sub MoveData()
Dim i As Long
Dim cell As Range

For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
Cells(i, "A").Value = Replace(Cells(i, "A").Value, " ", "|")
Next i
Columns("A:A").TextToColumns Destination:=Range("A1"), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
consecutiveDelimiter:=True, _
Tab:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=True, OtherChar:="|", _
FieldInfo:=Array(Array(1, 1), Array(2, 1),
_
Array(3, 1), Array(4, 1), Array(5, 1))

For Each cell In ActiveSheet.UsedRange
cell.Value = Trim(cell.Value)
Next cell

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Erik K via OfficeKB.com" <u13156@uwe wrote in message
news:56d9a5469aacb@uwe...
Yes, if there is only one space I do not want to move it to another cell

nor
delete the space. Any suggestions?

Bob Phillips wrote:
Does the question mean that if there is just one space you don't want to
split it? If not, you could use DataText To Columns delimited by space.

Can someone please tell me how to set a certain amount of spaces

between text
in a given cell? Here is what I have:

[quoted text clipped - 18 lines]
whatever text is set more than 2 spaces and move it to the next cell?

Any
answers?



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200511/1



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
Allow spaces between lines of text within cell ELeigh Excel Discussion (Misc queries) 1 March 4th 09 07:14 PM
how to erase all spaces in text cell? D Excel Worksheet Functions 3 May 23rd 06 08:41 AM
How to trim spaces from entered text in cell using exisiting functions? rj Excel Worksheet Functions 4 April 19th 06 08:40 PM
Delete Spaces and Join Text in Cell Diggsy Excel Worksheet Functions 3 October 5th 05 03:50 AM
Setting # of Spaces for vbTab Paige Excel Programming 3 August 18th 05 10:58 PM


All times are GMT +1. The time now is 01:08 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"