+ Reply to Thread
Results 1 to 3 of 3

Need help for a code in macro (to identify alpha numeric numbers)

  1. #1
    Forum Contributor
    Join Date
    04-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    128

    Need help for a code in macro (to identify alpha numeric numbers)

    Hi,

    I am preparing a macro which identifies and copies 9 digit alpha numeric code (alpha till 4). The code am using is "\b\w{0,9}\d{4,9}\b"

    But this code is copying alpha numeric numbers more than 9 too.....

    I need to prepare a macro which would take only 9 digit numbers (including alphabets till 5)

    My full macro code is
    Please Login or Register  to view this content.
    I am attaching the txt file from which this macro should copy the numbers. thanks
    Attached Files Attached Files
    Last edited by Paul; 04-19-2012 at 12:10 AM. Reason: Added CODE tags.

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

    Re: Need help for a code in macro (to identify alpha numeric numbers)

    1) Not recommend "Match" for variable name as it is a reserved word for VBA
    2) If 9 digits numbers only, Pattern should be "\b\d{9}\b"
    I would write like this
    Please Login or Register  to view this content.
    When you post the code, use the code tag
    e.g

    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    Last edited by jindon; 04-18-2012 at 10:26 PM. Reason: typo

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Need help for a code in macro (to identify alpha numeric numbers)

    Hello Raju Radhakrishnan,

    I added code tags to your post. This keeps your original formatting, making it easier to read, and easier to copy. Please do this in future posts. If you don't know how, see my signature line.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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