Consulting

Results 1 to 4 of 4

Thread: avoid "error 400"

  1. #1

    avoid "error 400"

    I'm trying to update my pivot-tables with a macro,how can I avoid error400? here is my code:

    [VBA]Sub RefreshPivotTables()
    Dim pivotTable As pivotTable
    For Each pivotTable In ActiveSheet.PivotTables
    pivotTable.RefreshTable
    Next
    End Sub[/VBA]

    Can anybody help me with that?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I use

    [vba]
    Activeworkbook.Refreshall
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    how can I make this run in a protected workbook?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Unprotect it in code, run that, then protect it after.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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