CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Code for Average in VBA

    Hi,

    Can someone please help with a single VBA syntax to calculate the average of some generated numbers?

    Thank you.

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Code for Average in VBA

    Its fairly simple just create a var to hold your total.
    Add all the numbers together
    Divide by the number of numbers used.

    Code:
    T=x+y+z
    A=T/3

  3. #3
    Join Date
    Jul 2009
    Location
    Kuwait
    Posts
    170

    Re: Code for Average in VBA

    Save the numbers generated to different variables. Then add all the values together and then divide it by the number of variables used. That will give you the solution .

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Code for Average in VBA

    Look up:

    Code:
    Eval()
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured