Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Convert Pivot Table to Values in Macro

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Convert Pivot table back to Data Table Samaa Excel Discussion (Misc queries) 2 March 21st 07 10:02 AM
convert Pivot table back to Data table Samaa Excel Discussion (Misc queries) 2 March 21st 07 09:22 AM
Selecting a range of values on pivot table attribute with a macro Ryan Hartnett Excel Discussion (Misc queries) 1 October 24th 06 10:21 PM
Convert Pivot Table to Normal Data table ashish128 Excel Discussion (Misc queries) 2 May 2nd 06 09:34 AM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"