+ Reply to Thread
Results 1 to 7 of 7

Find string and save...insert another string

  1. #1
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Find string and save...insert another string

    Hello,

    cel.Value = "Site Name PFD987_TDW38 is loaded into group 367-b."

    Can a search function, like Instr :

    - Search the contents of the cell
    - pick out the string or strings that start with P and save off
    - Replace entire contents of cell with
    "SITE LOAD-SITE NAME = PFD987_TDW38"

    - Also can this be done with different forms of word load: ex - load
    loading, loaded and with different number of characters in P*

    Thanks

  2. #2
    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 string and save...insert another string

    Hi,

    One way would be
    Please Login or Register  to view this content.
    Alternatively use a standard Excel function in another cell. e.g.
    Formula: copy to clipboard
    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.

  3. #3
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Find string and save...insert another string

    hey Richard -

    Thank you very much - this seemed to work good for the most part.

    Is there a way to just single out the P* string no matter what words surround it, are in front or back of it?

    Thanks

  4. #4
    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 string and save...insert another string

    Hi,

    Do you mean
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If not post an example.

  5. #5
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Find string and save...insert another string

    Here is what I tried to do and it gave me an error 'Sub or function bot defined':

    Please Login or Register  to view this content.

    And the cell value in this case is: PFD987_TDW38 is loaded into group 367-b


    So this is what is needed: No matter where the P* string is and regardless the number of characters in the P* string:
    1) pick it out of the string in the cell
    2) using keyword loaded or load, replace whole cell with "SITE LOAD-SITE NAME = PFD987_TDW38"

    Another example would be:

    Cell Value - "There was a site load for site PCHYU7896_FG_TY_12"

    new cell value - "SITE LOAD-SITE NAME = PCHYU7896_FG_TY_12"


    Thanks

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464

    Re: Find string and save...insert another string

    UDF

    Use in cell like

    =SiteName(A1,"P")

    To a Standard module
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-06-2012
    Location
    New Jersey, US
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Find string and save...insert another string

    Hello -

    Is there a simpler way to do it following the below code:

    Please Login or Register  to view this content.
    Is there anyway this can be done?

    Thanks

+ 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