Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default extracting strings from cell

Hi Arnand,

I should have added that the string

"AAA BBB CCC DDD"

is in fact double spaced.

If this is intentional, change:

arr = Split(sStr, Space(1))


to

arr = Split(sStr, Space(2))





---
Regards.
Norman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default extracting strings from cell

Or if the number of spaces were unknown:

arr = Split(sStr, Space(1))
becomes:
arr = Split(application.trim(sStr), Space(1))



Norman Jones wrote:

Hi Arnand,

I should have added that the string

"AAA BBB CCC DDD"

is in fact double spaced.

If this is intentional, change:

arr = Split(sStr, Space(1))


to

arr = Split(sStr, Space(2))


---
Regards.
Norman


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default extracting strings from cell

Hi Dave,

============
Or if the number of spaces were unknown:


arr = Split(sStr, Space(1))

becomes:
arr = Split(application.trim(sStr), Space(1))
============


Excellent improvemnt!

Thankyou!


---
Regards.
Norman
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default extracting strings from cell

============
Or if the number of spaces were unknown:


arr = Split(sStr, Space(1))

becomes:
arr = Split(application.trim(sStr), Space(1))
============

Excellent improvemnt!


Although some may not consider this an improvement because it is not as
clear as to what is going on, but the space character is the default
delimiter for the Split function, so, in this case, it can be omitted...

arr = Split(application.trim(sStr))

Rick

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
Extracting numbers from alphanumeric strings Poonam Excel Worksheet Functions 5 April 5th 08 01:27 AM
extracting numbers from alphanumeric strings mark kubicki Excel Programming 0 October 31st 06 09:08 PM
Extracting time from strings Ken McLennan[_3_] Excel Programming 6 February 23rd 06 03:52 PM
2 more questions about extracting numbers from text strings andy from maine Excel Discussion (Misc queries) 0 March 28th 05 09:47 PM
extracting numerics from literal strings Ed[_16_] Excel Programming 12 February 11th 04 09:07 PM


All times are GMT +1. The time now is 09:19 AM.

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

About Us

"It's about Microsoft Excel"