Results 1 to 4 of 4
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    Multiple Functions in a Selecion:Subtotal

    I have an excel spreadsheet that gets exported out of MS Access and then updated using MS Access VBA.

    The output of the file is:
    MANAGER|PROGRAM|REP|TOTAL DIAL\TOTAL TT|AVG DIAL|AVG TT

    I am trying to add subtotals but would like Columns 4, 5 to be xlSum and Columns 6, 7 to be XLAverage.
    I tried setting the replace to False on the second pass with no luck.

    I appreciate any help on this.

    Thanks

    Code:
          If .ProtectContents = False Then                    'Worksheets("qry_ExportCopy_Final").UsedRange.Select
                        ActiveSheet.Range("1:1").Font.Bold = True
                        ActiveSheet.Range("1:1").EntireColumn.AutoFit
                        'ActiveSheet.Cells.SpecialCells(xlBlanks).Value = 0
                        ActiveSheet.Range("E:E").NumberFormat = "[h]:mm:ss"
                        ActiveSheet.Range("G:G").NumberFormat = "[h]:mm:ss"
                        'ActiveSheet.Range("S:U").NumberFormat = "[h]:mm:ss"
                        
                        'ActiveSheet.Columns("F").TextToColumns Destination:=.Range("F1:F20000"), DataType:=xlDelimited
                        'ActiveSheet.Columns("G").TextToColumns Destination:=.Range("G1:G20000"), DataType:=xlDelimited
                        'ActiveSheet.Columns("J").TextToColumns Destination:=.Range("J1:J20000"), DataType:=xlDelimited
                        'ActiveSheet.Columns("K").TextToColumns Destination:=.Range("K1:K20000"), DataType:=xlDelimited
                        Selection.Subtotal Groupby:=2, Function:=xlSum, TotalList:=Array(4, 5), Replace:=True
                        Selection.Subtotal Groupby:=2, Function:=xlAvgerage, TotalList:=Array(6, 7), Replace:=False


  2. #2
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    Stupid brain missed the spelling mistake for 2 hours

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Glad you fixed it.

    But now I'm curious.... what spelling mistake?

  4. #4
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    Quote Originally Posted by ssanfu View Post
    Glad you fixed it.

    But now I'm curious.... what spelling mistake?
    I spelled Average Avgerage

Please reply to this thread with any new information or opinions.

Similar Threads

  1. The combo will not let a selecion in it
    By Lou_Reed in forum Access
    Replies: 6
    Last Post: 03-10-2017, 02:25 PM
  2. Replies: 3
    Last Post: 06-09-2013, 05:35 PM
  3. Subtotal
    By abc in forum Access
    Replies: 3
    Last Post: 01-31-2011, 04:47 PM
  4. Multiple IIF functions possible?
    By Northgate in forum Access
    Replies: 0
    Last Post: 10-08-2008, 01:11 PM
  5. Replies: 0
    Last Post: 06-07-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums