ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   split problem (https://www.excelbanter.com/excel-programming/437858-split-problem.html)

אלי

split problem
 
Hi all,

I am interesting to break a string with spaces into an array with substrings
and to have it in the same cell.
for example:
dim MyString as string
MyString = range("A1").value ' range("A1").value = "Good morning"
range("A1").value = split(MyString, " ").

The problem is that instead of:
Good
morning

as range("A1").value I get only: morning.

Please help me to fix it!

Thanks

Eli


Jacob Skaria

split problem
 
'Once you split it returns an array; so that you could try

Dim MyString As String
MyString = Range("A1").Value
Range("A1:B1") = Split(MyString, " ")

'Instead ..if you mean to replace a splace with carriage return then try
Range("A1") = Replace(Range("A1"), " ", vbLf)


--
Jacob


"אלי" wrote:

Hi all,

I am interesting to break a string with spaces into an array with substrings
and to have it in the same cell.
for example:
dim MyString as string
MyString = range("A1").value ' range("A1").value = "Good morning"
range("A1").value = split(MyString, " ").

The problem is that instead of:
Good
morning

as range("A1").value I get only: morning.

Please help me to fix it!

Thanks

Eli


אלי

split problem
 
Many thanks!

"Jacob Skaria" wrote:

'Once you split it returns an array; so that you could try

Dim MyString As String
MyString = Range("A1").Value
Range("A1:B1") = Split(MyString, " ")

'Instead ..if you mean to replace a splace with carriage return then try
Range("A1") = Replace(Range("A1"), " ", vbLf)


--
Jacob


"אלי" wrote:

Hi all,

I am interesting to break a string with spaces into an array with substrings
and to have it in the same cell.
for example:
dim MyString as string
MyString = range("A1").value ' range("A1").value = "Good morning"
range("A1").value = split(MyString, " ").

The problem is that instead of:
Good
morning

as range("A1").value I get only: morning.

Please help me to fix it!

Thanks

Eli



All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com