Results 1 to 2 of 2

Macro that steps, but won't run!

Threaded View

  1. #1
    Registered User
    Join Date
    06-22-2007
    Posts
    1

    Macro that steps, but won't run!



    System = Excel 2003, VB 6.3, Pent 4 2.9 ghz, 1.5 GB RAM, 21 GB free on HD (out of 40GB total)

    I have a spreadsheet that has about 10 tabs.

    To update each pivotable in each tab, I run the following code.

    At the same time, I want to readjust the column sizes (after updating the pivots, they expand too much due to header) This is where the problem lies.

    The Code will allow me to Step through it successfully, the columns resize, but will not RUN correctly!

    Here is the simple code:
     Sub AllWorkbookPivots()
    Dim pt As PivotTable
    Dim WS As Worksheet
    
        For Each WS In ActiveWorkbook.Worksheets
            
            For Each pt In WS.PivotTables
                        pt.RefreshTable
            Next pt
            ' Auto Formats the Column Widths
           
            Call ColumnsAutoWidthAdjustments
            WS.Activate
        Next WS
    End Sub
    
    Sub ColumnsAutoWidthAdjustments()
    
    ' ColumnsAutoWidthAdjustments Macro
    
    ' Keyboard Shortcut: Ctrl+Shift+W
    
        Cells.Select
        Range("a1").Activate
        Selection.Columns.AutoFit
        Range("B2").Select
    End Sub
    Any help would be greatly appreciated!
    Last edited by VBA Noob; 06-22-2007 at 01:18 PM.

Thread Information

Users Browsing this Thread

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

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