VBA pivot table create problem

Palucci

Banned user
Joined
Sep 15, 2021
Messages
138
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a problem, I would like to create a pivot table in sheet papers, from the selected data range. However, I get an error:
Object dosent support this property method
This is my code i know that its wrong but i dont know how to write correctly , maybe can someone help ?

VBA Code:
wbMe.Sheets("papiery").Range ("D1:L1")
    Range(Selection, Selection.End(xlDown)).Select
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "papiery!R1C4:R30C12", Version:=6).CreatePivotTable TableDestination:= _
        "papiery!R28C16", TableName:="Tabela przestawna3", DefaultVersion:=6
wbMe.Sheets("papiery").Select
    Cells(28, 16).Select
    With ActiveSheet.PivotTables("Tabela przestawna3").PivotFields("RES_MAT")
        .Orientation = xlRowField
        .Position = 1
    End With
    ActiveSheet.PivotTables("Tabela przestawna3").AddDataField ActiveSheet. _
        PivotTables("Tabela przestawna3").PivotFields("WYCENA_PLN"), _
        "Suma z WYCENA_PLN", xlSum
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Oh i changed to : Post is resolved

wbMe.Sheets("papiery").Range("D1:L1" & Columns.Count).End(xlDown).Select .
 
Upvote 0
Solution

Forum statistics

Threads
1,218,744
Messages
6,144,233
Members
450,532
Latest member
JadeRogers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top