+ Reply to Thread
Results 1 to 3 of 3

Code error “wrong number of arguments or invalid property assignment”

  1. #1
    Registered User
    Join Date
    04-28-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2003
    Posts
    24

    Code error “wrong number of arguments or invalid property assignment”

    What is wrong with this bit of code?

    Please Login or Register  to view this content.
    It points at an error in this line of code with error “wrong number of arguments or invalid property assignment”

    Please Login or Register  to view this content.
    Appreciate any help. Example attached.
    Attached Files Attached Files

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

    Re: Code error “wrong number of arguments or invalid property assignment”

    Hey,
    In the immediate window this line gets to "A"
    Please Login or Register  to view this content.
    Could it be you are looking for "A" in pivotfields(1) which is the Date? This might cause the error as dates and text are different?

    Also does .ColumnsFields work? ColumnsFields is really PivotFields(2) ?

    Also - in looking for a similar problem from the past, find the attached which may help.
    Attached Files Attached Files
    Last edited by MarvinP; 09-19-2011 at 12:38 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    04-28-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Code error “wrong number of arguments or invalid property assignment”

    Thanks MarvinP

    I got this to do what I want using the below

    Please Login or Register  to view this content.

    but i would like to build on this and have something like the below but I keep getting an error “wrong number of arguments or invalid property assignment”. So I thought it might be a syntax issue? The code below I believe is possibly better it that I am trying to use Variables, which would be better long term for the code


    Please Login or Register  to view this content.
    Could it be you are looking for "A" in pivotfields(1) which is the Date?
    I have fixed this now

    This might cause the error as dates and text are different?
    I am not looking at dates here, but I will be in another MACRO that I am working on

    Also does .ColumnsFields work? ColumnsFields is really PivotFields(2) ?
    I have fixed this now

    Thanks again

+ 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