none
VBA Subtotal without activating worksheet RRS feed

  • Question

  • I need to be able to subtotal a filtered table without activating the worksheet, is this possible?

    The code I'm using works fine as long as the sheet is activated.

    Monday, August 28, 2017 10:17 AM

All replies

  • KG,
    re:  is it possible

    Use the worksheet name instead of "ActiveSheet" ...  Worksheets("Sludge")
    Do not select anything.

    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)


    Monday, August 28, 2017 6:56 PM
  • You need to fully qualify the range.

    You probably have code like:

    Range("A1:D100").Subtotal....

    You need to change that to:

    Worksheets("SheetName").Range("A1:D100").Subtotal....

    and then it will work fine...

    If you have problems modifying your code, post back with your actual code and the name of the worksheet.... 

    Monday, August 28, 2017 6:58 PM