spaces

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
'<<=============
 
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
 
Back
Top