Results 1 to 5 of 5

Array of Ranges to work out average value PROBLEM!

Threaded View

  1. #1
    Registered User
    Join Date
    07-19-2014
    Location
    England
    MS-Off Ver
    2013
    Posts
    2

    Angry Array of Ranges to work out average value PROBLEM!

    I'm trying to create an array of ranges to use with the average function, I would like each range to be processed and the average value found to be printed. I'm getting error 1004 "unable to get average property of worksheet function"

    Private Sub CommandButton3_Click()
        Dim Ranges(1 To 7) As String
        Dim i As Long
        Dim RngAvrg1 As Long
          
    Ranges(1) = "C:C"
    Ranges(2) = "D:D"
    Ranges(3) = "E:E"
    Ranges(4) = "F:F"
    Ranges(5) = "G:G"
    Ranges(6) = "H:H"
    Ranges(7) = "I:I"
    
    i = 1
    
    Do Until i = 7
    
    RngAvrg1 = Application.WorksheetFunction.Average(Worksheets("Task_Data").Range(Ranges(i)))
            Sheets("Task_Data").Range("L" & i).Value = RngAvrg1
            
    i = i + 1
    
    Loop
     
        
        
    End Sub
    Last edited by AndresJanes; 07-19-2014 at 09:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to work out the average of an array from a changing cell
    By francesc in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-06-2014, 10:00 PM
  2. Array problem with Average
    By bronsonb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2011, 02:09 PM
  3. Average & Min Function Problem in Array Formula
    By mubashir aziz in forum Excel General
    Replies: 8
    Last Post: 05-20-2009, 02:07 AM
  4. select variables ranges, copy to array, paste the array in new workbook
    By Mathew in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2005, 05:06 AM
  5. Array Problem - Ranges
    By TonyRowland in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-24-2005, 05:27 PM

Tags for this Thread

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