Question : Relative Size Pivot Table Macro

I am writing a macro to create a pivot table, but each time I automatically create the pivot table, the size of the current selection will change.

I put my formula below. Right now, the pivot table is only looking for the size selection based on the time I created the macro. How can I make it so it will always select the data relative to what I need?

Thank you!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Sub CreatePivotTable()
'

    Range("A1").Select
    Selection.CurrentRegion.Select
    ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
        "'Raw Actual Data'!R1C1:R3286C6", TableDestination:="", TableName:= _
        "PivotTable2"
    ActiveSheet.PivotTables("PivotTable2").SmallGrid = False
    ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:=Array("Dept", _
        "Natural Class B""  (GDE)""", "Dept2")
    With ActiveSheet.PivotTables("PivotTable2").PivotFields("Actuals")
        .Orientation = xlDataField
        .Name = "Sum of Actuals"
        .Function = xlSum
    End With
    ActiveSheet.Name = "Actuals Pivot Table"
    
End Sub

Answer : Relative Size Pivot Table Macro

It's not everything, it's the Southwest image.  Delete the 'position:relative;' from 'sidebar1IMG1'.  I would also put 'width:480px;' on the 'movie'.
Random Solutions  
 
programming4us programming4us