+ Reply to Thread
Results 1 to 3 of 3

Cleaning up Code, better solutions?

  1. #1
    Registered User
    Join Date
    02-04-2010
    Location
    Songtan, South Korea
    MS-Off Ver
    Excel 2007
    Posts
    1

    Cleaning up Code, better solutions?

    Honestly I'm a relative noob when it comes to Excel. I can do the basics and maybe a few intermediate things, but thats about it.

    I took over a job monitoring and identifiying unauthorized software on the machines on our network, and the concept laid out by the guy before me, is interesting and very functional... but there's a hitch:

    The code in the Macro he developed to identify unauthorized looks like this:

    Cells.Replace What:="Acer eDisplay Management* (*)[*]", Replacement:="" _
    , LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat _
    :=False, ReplaceFormat:=True

    and it works fine, except that his macro only containd 30 or so items each with its own line of code, and the list that is intended to be used has about 2600 items! that many lines of code causes a "procedure too large" error.

    Having no real expierence with exel macros, and no one to get help from locally, I wanted to know if there was a way to still incorperatre the 2600 items and not get the error.

    Any help would be appriciated
    Last edited by rod419; 02-04-2010 at 07:12 PM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Cleaning up Code, better solutions?

    rod419,

    Welcome to the Excel Forum.

    You may be able to read the 2600 items into an array, and then cycle each array item into the formula.

    Can you post your workbook? If so, then click on "New Post" and scroll down and see "Manage Attachments".
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cleaning up Code, better solutions?

    So, you have a list 2600 "phrases" that you want to search for and replace them with nothing? Effectively clear the cells that have those values?

    Put those 2600 phrases/text strings into a separate sheet (sheet2) in one column (col A). Then a macro like this can go through all of them:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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