willie108
asked on
vba macro for pivot table including "blank"
I am running the attached vba for creating a pivot table from the attached data. I don't know why it is including "blank" as one of the entries in the pivot table.
Sub makeRelativePivot2()
'
' makeRelativePivot2 Macro
'
'
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"perStockTweets!R1C1:R3926C7", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="", TableName:="PivotTable5" _
, DefaultVersion:=xlPivotTableVersion14
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Date")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
"PivotTable5").PivotFields("Tweet ID"), "Sum of Tweet ID", xlSum
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.PivotTables("PivotTable5").PivotFields("Sum of Tweet ID").Function _
= xlCount
End Sub
Anyone know about it?
Hard to be sure without the data but I'd guess one of your key cells is blank.
ASKER
Hello. I thought I attached the data. Let me try it again.
sample.csv
sample.csv
ASKER
Hello. I attached the data in the previous post. I also tried to make a pivot table manually and did not get a blank row.
Thanks.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Will that be flexible? I want to use it on data for which I don't know the number of rows.
ASKER
Great. Thanks.