+ Reply to Thread
Results 1 to 3 of 3

Find substring using vba

  1. #1
    Registered User
    Join Date
    03-14-2007
    Posts
    16

    Find substring using vba

    I'm trying to find a string in a string and return everything after the colon as a string.

    basestring: "my base string: this is a test"
    string to find: "my base string:"

    I've BEEN TRING INSTR but I only get a number that I thing is the starting position.

    Any help will be appreciated.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Find substring using vba

    Here is a non-vba solution. Data is in A1

    =RIGHT(A1,LEN(A1)-FIND(":",A1)-1)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Find substring using vba

    ...if you really need VBA, and generally it's quicker to stick to Excl functions when they're available, then

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find substring by mark
    By arbazhamayun in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-01-2018, 06:40 AM
  2. Replies: 8
    Last Post: 03-09-2018, 11:39 AM
  3. how to find substring between first and third dashes?
    By edjusted in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-04-2016, 09:03 PM
  4. Macro to search cells for substring and replace contents of cell if substring is found
    By robbyvegas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2015, 06:40 AM
  5. Search substring within range, report the substring found
    By Brooke1578 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2012, 03:56 PM
  6. Find and Replace Substring
    By ncalenti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2012, 06:54 PM
  7. [SOLVED] Extract Substring, then Ignore that Substring, while collecting data from Other substrings
    By Sameki121 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2012, 05:21 PM

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