I have a VBA code in an Excel add-in that is suppose to create a pivot table.
How do I reference the worksheet I have opened from the Excel add-in vba code?
I get an error when I execute the line: Set objTable = Sheet1.PivotTableWizard > Run-time error '1004' Application-defined
'Dim objTable As PivotTable, objField As PivotField
ActiveWorkbook.Sheets("logs").Select
Range("A3:AN6").Select
'****** Run-time error '1004' Application-defined or object defined error at line below
Set objTable = Sheet1.PivotTableWizard
Set objField = objTable.PivotFields("Type")
objField.Orientation = xlRowField
Set objField = objTable.PivotFields("Size")
objField.Orientation = xlColumnField
Bookmarks