+ Reply to Thread
Results 1 to 10 of 10

Unable to get the average property of the worksheetfunction class

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Unable to get the average property of the worksheetfunction class

    Hi,

    I have Userform to display some averages by year, and use It on multiple sheets. I get this error on sheets that are currently blank (future years).

    How can get rid of this and simply display 0 values If range is empty ?

    Sample is attached, open userform on second or third sheet to see error !

    Any help appreciated !
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Unable to get the average property of the worksheetfunction class

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Unable to get the average property of the worksheetfunction class

    Hi rcm,

    this formula works on worksheet indeed. But I have Userfom to display this result, and code for this is:

    Please Login or Register  to view this content.

    I believe lines that are red need to be changed, in VBA.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Unable to get the average property of the worksheetfunction class

    You could introduce a test on the range and set the value accordingly like so:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Unable to get the average property of the worksheetfunction class

    You could add at the beginning of the code
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Unable to get the average property of the worksheetfunction class

    hi Trebor76,

    I tried your code but could not get it working... Can you post example form my file ?

  7. #7
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Unable to get the average property of the worksheetfunction class

    rcm, on resume next those two errors are not displayed on Userfom, so It's no use to me. I need all data displayed, just zero values for those with error. I guess I need some error handler ?

  8. #8
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Unable to get the average property of the worksheetfunction class

    I figure It out on my own, just forming an error handler does the trick


    Please Login or Register  to view this content.
    thanks for help both of you !!

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Unable to get the average property of the worksheetfunction class

    How about htis one. You start with empty combobox, when selecting year you go to that page and calculations are made instantly.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: Unable to get the average property of the worksheetfunction class

    Hi Bakerman, thanks for post, your solution is also fine, but I'll stick to my own.

    Thanks for help !

+ 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. Unable to get the Vlookup Property of the WorkSheetFunction Class
    By jayeshsondhi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2015, 03:57 AM
  2. [SOLVED] Unable to Get the Vlookup property of the WorksheetFunction class
    By DrowingInVBA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2013, 02:02 PM
  3. Unable to get Match property of the WorksheetFunction class
    By pavu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2012, 10:00 AM
  4. Unable to get countIF property of worksheetFunction class
    By Deamo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-10-2010, 09:35 PM
  5. Unable to get the VLookup property of the WorksheetFunction class
    By JesseBurton in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 12-09-2009, 10:29 AM
  6. Replies: 2
    Last Post: 12-13-2007, 09:59 AM
  7. Unable to get the Vlookup property of the WorksheetFunction class
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2006, 02:55 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