Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Truncate text

Sorry - perhpas you mean you wanted everything to the left of the last
slash?

Sub test()
Dim str As String

str = "abcde/fghij/klmno/pqrst"
str = Left(str, InStrRev(str, "/") - 1)
End Sub

or the first slash?

Sub test()
Dim str As String

str = "abcde/fghij/klmno/pqrst"
str = Left(str, InStr(str, "/") - 1)
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob van Gelder" wrote in message
news:...
I think InStrRev is XL2000

Sub test()
Dim str As String

str = "abcde/fghij/klmno/pqrst"
str = Mid(str, InStrRev(str, "/"))
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"JAmes" wrote in message
...
Hi Gang
How can I truncate text to the right of and including / in a cell. Woul

dlike to do it through code
Thanks!





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 truncate linked text? Jenni Excel Worksheet Functions 1 April 9th 10 07:10 PM
truncate text to first word Harry C Excel Discussion (Misc queries) 5 July 3rd 08 05:14 AM
How do you truncate a text string? dailygluttony Excel Worksheet Functions 2 March 28th 06 08:08 PM
Truncate text JAmes Excel Programming 6 April 7th 04 01:18 PM
truncate text using VBA Excel maehe Excel Programming 2 November 21st 03 12:58 PM


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