+ Reply to Thread
Results 1 to 3 of 3

Removing first three characters in a string - vb code

Hybrid View

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    Mumbai,india
    MS-Off Ver
    Excel 2003
    Posts
    21

    Removing first three characters in a string - vb code

    Hi all,

    I have a problem with removing first three characters of a string in vb. I should remove only the first three characters in all strings irrespective of what is in the fourth position.

    for eg... in the strings--- "Lum001" and "Lum Rev-01"

    i want the result as "001" and"rev -01" respectively.

    wat should i code to get this.


    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Removing first three characters in a string - vb code

    Your examples are inconsistent, the second one should produce " rev-01" (note the leading space)

    The code is fairly trivial:

    MyNewVar=Mid(OldString,4)
    If you want to be shot of trailing/leading spaces use:

    MyNewVar=Trim(Mid(OldString,4))

  3. #3
    Registered User
    Join Date
    07-30-2010
    Location
    Mumbai,india
    MS-Off Ver
    Excel 2003
    Posts
    21

    Thumbs up Re: Removing first three characters in a string - vb code

    Thanks Andrew,

    it got work

    Thanks a lot

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1