+ Reply to Thread
Results 1 to 6 of 6

Macro to match left string

  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Macro to match left string

    I am able to write a formula to extract the first 6 characters of a cell

    = LEFT(A6, 6)

    with A6 being the particular cell that the data is coming from

    What I'm wanting to do is be able to insert a similar command into a macro that will delete the entire row for each row that has a specific string at the start of the cell contents. The loop will end when there is no data in column 1. There are thousands of records that I need to check this data from, and I'm not sure of how to do it

    What I have so far is this, with the string that I'm looking for is "6digit"


    Please Login or Register  to view this content.
    with the red portion the code that I know is wrong. Any help on this would be greatly appreciated. Thanks

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to match left string

    Try this
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Macro to match left string

    Does this work?

    Please Login or Register  to view this content.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: Macro to match left string

    When I add this I get the following error

    Compile error: Argument not optional

    Quote Originally Posted by Special-K View Post
    Does this work?

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to match left string

    You can try my code or you can edit Special-K's code to this 0
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Re: Macro to match left string

    But this one worked

    Thanks for the help

    Quote Originally Posted by arlu1201 View Post
    Try this
    Please Login or Register  to view this content.

+ 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. Need a Macro, so that it will search a string and clear the cell and its left cell
    By sibasundar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 08:54 AM
  2. How to write macro for find and match particular string in a column
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2012, 08:20 AM
  3. how to write macro to find and match common string and write the keyword
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2012, 07:41 AM
  4. Macro to truncate string... like "Len,Left,Right formulas"
    By Xx7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-28-2011, 11:16 PM
  5. Replies: 2
    Last Post: 10-23-2010, 04:54 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