+ Reply to Thread
Results 1 to 5 of 5

Runtime error 1004 with use of WorksheetFunction

  1. #1
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Runtime error 1004 with use of WorksheetFunction

    Hello guys,

    Few hours ago, I wrote a simple procedure in order to get an average of a range of 10 cells (A1:A10). Within the code, I typed these following lines:

    Please Login or Register  to view this content.

    Unfortunately, I get the following error message each time I execute the procedure:

    “Runtime error 1004 : Unable to get the Average property of the WorksheetFunction class”

    I have no idea how to figure out what is the solution to this error. I would greatly appreciate if you guys could take a look at this code.

    Have a nice one,
    Johny
    Last edited by Johny027; 12-15-2009 at 06:11 AM. Reason: Correction done

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

    Re: Runtime error 1004 with use of WorksheetFunction

    Johny027,

    Try:

    Please Login or Register  to view this content.
    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
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Runtime error 1004 with use of WorksheetFunction

    Thank you stanleydgromjr for your taking the time to write this short message.

    Unfortunately, I could still discover the same window after executing the procedure:

    “Runtime error 1004 : Unable to get the Average property of the WorksheetFunction class”

    I really don't know what is wrong with my code.

    Have a nice day,
    Johny

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Runtime error 1004 with use of WorksheetFunction

    Johnny, posting partial code is rarely helpful...

    You have myrange declared as a Variant rather than as a Range - any particular reason for that ?

    Further, how is myrange populated ?

    Can you conduct the same average natively without error ?

    You would get the 1004 error should either of the below hold true:

    a) underlying values contain errors (eg #VALUE!, #N/A, #DIV/0! etc...)

    b) no numerical values to average

  5. #5
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Runtime error 1004 with use of WorksheetFunction

    Thanks for your suggestion DonkeyOte,

    You forced me to examine again the purpose of this Runtime Error. Myrange was populated with 10 similar numbers as 77,55 or 78,45 …etc.

    I am sorry for previously posting such a question. I simply worked with uncommon data (decimal points being replaced by commas)

    Have nice one,
    Johny.
    Last edited by Johny027; 12-15-2009 at 06:10 AM. Reason: data correction

+ 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