+ Reply to Thread
Results 1 to 4 of 4

Using 'Filter(array,"text")' within a macro for lines that begin with "text"

  1. #1
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    201

    Using 'Filter(array,"text")' within a macro for lines that begin with "text"

    I have a section of code that looks likes this:
    Please Login or Register  to view this content.
    It reads a cell that contains multiple lines of text (the 'interface' section for one group of sub interfaces in data from a Cisco 'sh run' command).
    These will be multiple lines, where there will be one or more lines that start with the text "interface ". Unfortunately, the way I'm doing this will find the word 'interface ' anywhere on the line, not just the lines that begin with that string.
    You can see in the above bit of code, I cheated by adding a few characters.
    How do I do an array filter for a "begins with" match?
    My little "For x" / "next x" loop is a kludge to add "no " to the beginning of the interface lines that I found. I couldn't figure out (well... find on google) how to just add the string to the beginning of all hits in my new array.

    I used to have code that looked like this:
    Please Login or Register  to view this content.
    that has abruptly stopped working correctly (Post migration to a Windows 7 system and unknown updates to Office). That code would do the "begins with" quite nicely and for multiple contiguous columns.
    Now, I have to loop through and do this "manually"

  2. #2
    Forum Contributor Rhudi's Avatar
    Join Date
    03-08-2013
    Location
    South Carolina, US
    MS-Off Ver
    Professional Plus 2016 aka Office 365
    Posts
    201

    Re: Using 'Filter(array,"text")' within a macro for lines that begin with "text"

    Here is my drain-bamaged "solution"...
    Please Login or Register  to view this content.
    *sigh*

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Re: Using 'Filter(array,"text")' within a macro for lines that begin with "text"


    Filter function example "begins with" :

    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,987

    Re: Using 'Filter(array,"text")' within a macro for lines that begin with "text"

    I think you'd be better off just filtering for interface and then testing the left part of the string in the loop before you prepend 'no '. It would seem more efficient than two loops.
    Everyone who confuses correlation and causation ends up dead.

+ 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. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 AM
  2. advanced filter criteria "begins with" and "does not begin with"
    By Eddie O in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 06:05 AM
  3. [SOLVED] advanced filter criteria "begins with" and "does not begin with":how can use all 3 cr
    By raph_baril in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-28-2005, 06:05 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