Monday, September 26, 2016

[Solved] Data changes for pivot table - VB code

Data changes for pivot table - VB code

Hello all,
I have the following VB code for a pivot table.
How can I pick up any size data from a table?  Some day's it could be 100 lines and other days it could be 65,000 lines.
I'm running a macro and need to pickup the data.
Thanks
    Range("A1").Select
    Sheets.Add
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Select Statement Invoice de (2)!R1C1:R11110C3", Version:= _
        xlPivotTableVersion10).CreatePivotTable TableDestination:="Sheet2!R3C1", _
        TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
    Sheets("Sheet2").Select
    Cells(3, 1).Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("File Number")
        .Orientation = xlRowField
        .Position = 1
    End With
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
        "PivotTable1").PivotFields("Line Amount"), "Sum of Line Amount", xlSum
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Total"

Keys to the Problem Data changes for pivot table - VB code

Download SmartPCFixer to Fix It (Free)

Dim r as Range
Range("A1").Select
    Sheets.Add
    set r = worksheets("Select Statement Invoice de (2)").Range("A1").currentRegion
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=r, _
       Version:=xlPivotTableVersion10).CreatePivotTable TableDestination:="Sheet2!R3C1", _
        TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
    Sheets("Sheet2").Select
    Cells(3, 1).Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("File Number")
        .Orientation = xlRowField
        .Position = 1
    End With
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
        "PivotTable1").PivotFields("Line Amount"), "Sum of Line Amount", xlSum
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Total"
 
--
Regards,
Tom Ogilvy

  • Download the Microsoft Windows ISO (installation device) from the following website:
  • http://www.microsoft.com/en-us/software-download/windows10
  • Users must select the appropriate ISO, either 32 bit or 64 bit, depending upon their individual computer.
  • Extract the ISO file to a separate USB device or burn the program to a compact disc.
  • Run the Microsoft Windows 10 upgrade directly from the software that you have thus created.

Recommended Method to Fix the Problem: Data changes for pivot table - VB code:

How to Fix Data changes for pivot table - VB code with SmartPCFixer?

1. Click the button to download SmartPCFixer . Install it on your computer.  Open it, and it will scan your system. The errors will be shown in the scan result.

2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.

3. The Repair part is finished, the speed of your computer will be much higher than before and the errors have been fixed. You can also use other functions in SmartPCFixer. Like dll downloading, junk file cleaning and print spooler error repair.


Related: How to Update & Download NVidia GeForce 6100/nForce 420 WHQL Certified driver v.178.13,How to Update & Download NVidia GeForce 7600 GS Video Driver v.295.75 Certified,How Can I Update & Download NVidia GeForce 820M Driver v.344.48 WHQL,[Solved] Download NVidia GeForce GTX 560M VGA Driver v.296.17 Certified,Way to Update & Herunterladen NVidia GeForce GT 130M Video Treiber v.295.75 Certified,How to Update & Download SONY SVE14A1X1RH Realtek Ethernet Driver,Where to Download SONY SVS13A2W9ES Bluetooth Driver (Intel) v.2.6 - 2.6.23.40059,Best Way to Update & Download SONY VGN-CR203E Conexant HDAUDIO SoftV92 Data Fax Modem with SmartCP Setup Program v.7.62.0.50 driver,Best Way to Download SONY VGN-FE790G/N Wireless LAN Driver v.10.6.0.29,Method to Update & Download SONY VGN-NR31Z/S Firmware Extension Parser Device v.8.0.2.3,How to Fix Error 0x0000c1f5 SoluciĆ³n?,Error 0x80071a91 Win7 Fix Patch,Error 0x800ccc60 Windows Live Mail [Solved],Error Message 0x800ccc79 Outlook 2000 Fix,What is Error 0xc1ab0001?,[Answered] x64 saplugin dll,How to Fix Problem - Kb943729 Download?,Troubleshooting: Bccode D1 Error,Java Runtime Tech Support,Troubleshooting: ERROR NO SUCH GROUP Error
Read More: How Can You Fix - Data table in bar chart?,Tech Support: Desktop Icon issue - large,WLAN icon appears on desktop,How Can You Fix - Cut first 5 characters in column?,How Can You Fix - Cursor won't move to the top of the page. In align, top is grayed out.?,Solution to Problem: Data source to cover many sheets.

No comments:

Post a Comment