Hi All
I’m new to here and fairly new to VB so any help would be greatly appreciated
I have a sheet with data that can change each day so the range of data will always be different. The columns and headers will always stay the same. But I might have data on row 5 todays and tomorrow it might be row 30.
I have the below code which is recorded using the macro, how would l change the code to always find the last row and then create the macro.
After this, I would like it to then place the pivot on the same sheet as I am working on but in a location which is 5 lines below the last piece of data in column C.
Any help would be much appreciated
Sub statementpivot() ' ' statementpivot Macro ' Range("G35").Select ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "'1596'!R1C1:R24C45", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:="'[Global Extract - 30-11-2012.XLS]1596'!R35C7", _ TableName:="PivotTable2", DefaultVersion:=xlPivotTableVersion10 ActiveWorkbook.ShowPivotTableFieldList = True With ActiveSheet.PivotTables("PivotTable2").PivotFields("SITE NAME") .Orientation = xlRowField .Position = 1 End With ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _ "PivotTable2").PivotFields("OPEN AMOUNT GBP SUM"), "Sum of OPEN AMOUNT GBP SUM" _ , xlSum With ActiveSheet.PivotTables("PivotTable2").PivotFields("DUE DATE") .Orientation = xlRowField .Position = 2 End With ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _ "PivotTable2").PivotFields("OPEN AMOUNT SUM"), "Sum of OPEN AMOUNT SUM", xlSum With ActiveSheet.PivotTables("PivotTable2").DataPivotField .Orientation = xlColumnField .Position = 1 End With End Sub