+ Reply to Thread
Results 1 to 5 of 5

VBA Code Tweak

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    70

    VBA Code Tweak

    Hi all,

    I have a Macro I'm using to tidy up a text export from another program. The line below looks for specific product codes, then extracts the various fields.

    However, we have now introduced a whole host of new product codes which begin with a vast range of characters. Is there a way I tweak the first line of the code below to say thet "If there are any numeric values within the first eight characters of each line, extract"?

    Please Login or Register  to view this content.
    Many thanks in advance!

  2. #2
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: VBA Code Tweak

    you could use regex to check that this checks if there is at least 1 numeric value in the given string
    so if you pass the first 8 chars of your string to the Function then it will return true if there is a number and False if not
    you need to make a reference to Microsoft VBscript Regular Expressions 5.5 to run the code

    Please Login or Register  to view this content.
    A second way would be to loop through the string and check for number with isnumeric that would not need any reference

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: VBA Code Tweak

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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. Can someone tweak a small vba code for me?
    By boniouk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2013, 07:35 AM
  2. Tweak an Existing Code
    By mkeys4 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2013, 10:00 AM
  3. VBA Code tweak to include formats
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2012, 11:08 AM
  4. Tweak code to use string vs number
    By dannac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2012, 02:00 PM
  5. Copy Table Code - Tweak
    By SamuelT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2010, 10:58 AM
  6. Best way to 'tweak' my code?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2008, 10:10 AM
  7. tweak code for excel 2007
    By Duncan1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2007, 12:54 PM
  8. [SOLVED] Code Tweak
    By bodhisatvaofboogie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2006, 11:40 AM

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