+ Reply to Thread
Results 1 to 5 of 5

Looping through a Range,Filter and copy visible cells

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Looping through a Range,Filter and copy visible cells

    Hi,

    I'm having a problem with this script below. I keep getting a "Named Argument Not Found" What I'm trying to do is simply loop through the names in col "N" Create a new worksheet which works from the cell value. Then what I want to do is filter the list by the cell value then copy the filter list to the new worksheet that was just created. I tried to use cell.value and just cell, however the list wont filter I just get the error from above.

    Would someone please point out what is wrong with the script below?

    Thank You, Mike

    Please Login or Register  to view this content.
    Last edited by realniceguy5000; 03-31-2011 at 02:14 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Looping through a Range,Filter and copy visible cells

    Hi,

    Searching the web for "Named Argument Not Found" many answers asks what version of Excel is being used. Is there a chance you are running this on an older version of Excel where the maximum row number or maximum number of sheets is being exploited?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Looping through a Range,Filter and copy visible cells

    Quote Originally Posted by MarvinP View Post
    Hi,

    Searching the web for "Named Argument Not Found" many answers asks what version of Excel is being used. Is there a chance you are running this on an older version of Excel where the maximum row number or maximum number of sheets is being exploited?
    Hi, I'm using Office 2003. I checked the data the Last Row is 4350, as far as the sheets I only have 2 at the time of the error. One is the blank sheet just made and the other has the data with the filter on it.

    Thank You.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Looping through a Range,Filter and copy visible cells

    Hi Mike,

    In the Excel object model, Worksheet objects have an autofilter property and Range objects have an autofilter method. These are quite distinct. I've coloured in your code below to indicate which is which.
    Please Login or Register  to view this content.
    The Worksheet.Autofilter property does not accept any arguments. The Range.Autofilter method accepts 5 optional arguments.

    The reason you are getting the error is because you are trying to pass 2 arguments into the Worksheet.Autofilter property.
    Please Login or Register  to view this content.
    On that line you should be using the Range.Autofilter method.

    I hope that makes sense; let us know if you need us to post revised code for you?
    Hope that helps,

    Colin

    RAD Excel Blog

  5. #5
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Looping through a Range,Filter and copy visible cells

    Quote Originally Posted by Colin Legg View Post
    Hi Mike,

    In the Excel object model, Worksheet objects have an autofilter property and Range objects have an autofilter method. These are quite distinct. I've coloured in your code below to indicate which is which.
    Please Login or Register  to view this content.
    The Worksheet.Autofilter property does not accept any arguments. The Range.Autofilter method accepts 5 optional arguments.

    The reason you are getting the error is because you are trying to pass 2 arguments into the Worksheet.Autofilter property.
    Please Login or Register  to view this content.
    On that line you should be using the Range.Autofilter method.

    I hope that makes sense; let us know if you need us to post revised code for you?
    Hi, It makes perfect sense now. I changed my code to this below and everything is working.

    Thank You Very Much... Mike

    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)

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