PC Review


Reply
Thread Tools Rate Thread

Convert Pivot Table to Values in Macro

 
 
Buck
Guest
Posts: n/a
 
      16th Mar 2010
The code below converts multiple worksheets to values. Except, as I
discovered recently Pivot Tables. Can you help modify the code to also
convert Pivot Tables to Values?

=============
Sub SetAllSheetsToValues()
Dim shtSheet As Worksheet, shtActive As Worksheet
Dim rngR As Range, rngCell As Range
Application.ScreenUpdating = False
Set shtActive = ActiveWorkbook.ActiveSheet
For Each shtSheet In ActiveWorkbook.Sheets
With shtSheet
If .ProtectContents = False Then ' skip protected sheets
On Error Resume Next
Set rngR = .UsedRange.SpecialCells(xlCellTypeFormulas, _
xlErrors + xlLogical + xlNumbers + xlTextValues)
On Error GoTo 0
If Not rngR Is Nothing Then
For Each rngCell In rngR
rngCell.Value2 = rngCell.Value2
Next rngCell
End If
End If
End With
Next shtSheet
shtActive.Activate ' reset to original active sheet
[a2].Activate
Set shtActive = Nothing
Application.ScreenUpdating = True

End Sub
=============

I modified this line (below) to include "+xlPivotTables" and ran it. It
didn't bomb out but neither did it convert to values.

Set rngR = .UsedRange.SpecialCells(xlCellTypeFormulas, _
xlErrors + xlLogical + xlNumbers + xlTextValues)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying values from pivot table to cells outside pivot table richzip Microsoft Excel Misc 4 16th Jan 2008 11:03 PM
Convert Pivot table back to Data Table =?Utf-8?B?U2FtYWE=?= Microsoft Excel Misc 2 21st Mar 2007 10:02 AM
convert Pivot table back to Data table =?Utf-8?B?U2FtYWE=?= Microsoft Excel Misc 2 21st Mar 2007 09:22 AM
Selecting a range of values on pivot table attribute with a macro =?Utf-8?B?UnlhbiBIYXJ0bmV0dA==?= Microsoft Excel Misc 1 24th Oct 2006 10:21 PM
Convert Pivot Table to Normal Data table ashish128 Microsoft Excel Misc 2 2nd May 2006 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:14 AM.