#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default spaces

Hi all, how do I find the first space from the right or the last space from
the left in a string of 30 chars e.g. "the rainfall is very heavy thi"

Thanks as always
--
delmac
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default spaces

Hi Delmac,

Try something like:

'=============
Public Sub Tester()
Dim iPos As Long
Const sStr As String = "the rainfall is very heavy thi"

iPos = InStrRev(sStr, Space(1))
MsgBox iPos
End Sub
'<<=============



---
Regards,
Norman


"delmac" wrote in message
...
Hi all, how do I find the first space from the right or the last space
from
the left in a string of 30 chars e.g. "the rainfall is very heavy thi"

Thanks as always
--
delmac



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default spaces

Hi Delmac,

I should have added that, IIRC, the InStrRev was
introduced in xl2K.


---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default spaces

Hello
Use InstrRev.
eg:
InStrRev("the rainfall is very heavy thi", " ", -1, vbTextCompare)

This will return the position of the first space found strating from the
right.

HTH
Cordially
Pascal


"delmac" a écrit dans le message de news:
...
Hi all, how do I find the first space from the right or the last space
from
the left in a string of 30 chars e.g. "the rainfall is very heavy thi"

Thanks as always
--
delmac



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 do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Spaces [email protected] Excel Worksheet Functions 6 January 8th 07 03:53 PM
spaces not recognized as spaces windsurferLA Excel Worksheet Functions 9 July 27th 06 11:49 AM
Help copying a range with spaces to a range without spaces Andy Excel Programming 1 September 23rd 03 04:26 PM
Spaces Steve Wylie Excel Programming 7 August 28th 03 07:46 PM


All times are GMT +1. The time now is 02:40 PM.

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"