+ Reply to Thread
Results 1 to 10 of 10

REPLACE with Array List with Wild Card

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    REPLACE with Array List with Wild Card

    Hello,

    I have the following code, and I'm having difficulty replacing those that I've assigned in red color.

    May I know what's is wrong with the code.

    As you can see....if it's a single such as "." , " " , "(" etc, it actually removed. Problem starts when I tried to remove anything that's 000HYR* or HYR* etc.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: REPLACE with Array List with Wild Card

    I tried that once without a solution, a workaround would be:
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: REPLACE with Array List with Wild Card

    Thanks techneXus!!!

    Star for you! Please check!

  4. #4
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: REPLACE with Array List with Wild Card

    Quote Originally Posted by dluhut View Post
    Just wondering if it's possible to modify a little bit the code to have apostrophe at the beginning? i.e '1234567 or '05ABCD0123000BLCA1020

    Reason being, if the value of a particular cell of a given range is numeric...may it be whole numbers or with decimals, I would like it to appear in text...that's why the apostrophe at the beginning of the "string"
    Add
    Please Login or Register  to view this content.
    below the array loop

  5. #5
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: REPLACE with Array List with Wild Card

    Tried to add the suggested code. Although it's making the cell as text, but it's not functioning as what I want it to be.

    for example, for a long whole number, it'll make it into scientific term...i.e. 1234567890 will make it to 1.234E+10 for example. Another example will be, 001234 will becomes 1234.

    The reason I want an apostrophe in front of each string is to keep the format of it, may it be numbers (whole number or decimals) or alphanumeric.

    So in the above example, I'll have it as '1234567890 and '001234
    Last edited by dluhut; 05-27-2013 at 10:06 AM.

  6. #6
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: REPLACE with Array List with Wild Card

    Hi,

    could you provide a sample workbook with some data to test please.

    The above code works fine for me: When I enter "1234567890" into column A and format it as Scientific Number then it will be displayed as "1,23E+09" in column A, when is code ran this number is displayed as "1234567890" in with format Text column B.

  7. #7
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: REPLACE with Array List with Wild Card

    Sure thing.

    Here's the sample.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: REPLACE with Array List with Wild Card

    Ok, the numberformat wasn't the solution but this works for me (added a loop after copying the values to column B):
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: REPLACE with Array List with Wild Card

    Although I haven't tried the code yet, I believe this will work!

    Thanks tehneXus!

    Correct me if I'm wrong. I believe the added code is because it's from B1:B12. Am I correct?

    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: REPLACE with Array List with Wild Card

    The code loops the cells in column B before the replacement and adds an "'" in front, so you have strings everywhere now.

+ 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