Consulting

Results 1 to 7 of 7

Thread: Solved: Anybody know how to speed up subtotals?

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Solved: Anybody know how to speed up subtotals?

    I don't think it is possible but if it is please help:

    [VBA]Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(4, 5, 6, 7, _
    8, 9, 11, 12, 13, 14, 18), Replace:=False, PageBreaks:=False, SummaryBelowData:= _
    True[/VBA]

  2. #2
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    if this isn't possible can someone tell me so?

  3. #3
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Daniel,

    Generaly the fastest way to do something is to leverage the built in objects in the object model, of which subtotal is one. I'd suggest that if your subtotal code is going slowly, then you're not going to be able to speed it up much.

    You could try flipping calc mode to manual, then apply your subtotals then switch back to Auto, and that might help.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  4. #4
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    ken,

    That is what I thought. Thank you.

  5. #5
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    You could try not using Selection.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Norie
    You could try not using Selection.
    That will only help if the code does the selection. If the selection is done in Excel, then it is just a range object like any other.

  7. #7
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Well there's no way to tell how the selection is done without either seeing the rest of the code and/or getting more information from the OP.

Posting Permissions

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