hi guys. i edited this code i found provided by Andy Pope. the whole code is not going to work because i haven't changed it. but what i'm stuck with is this part where i realised the code is not working when the number of characters in a cell exceeds 255. this is supposed to be for an xls file.
so i only need help for it to work past this particular last line of code:
Sub test()
Dim rngData As Range
Dim rngOutput As Range
Dim strPTName As String
Dim pvtTable As PivotTable
With Worksheets("Sheet1")
LastRowTemp = .Cells(Rows.Count, "A").End(xlUp).Row
Set rngData = .Range("A1:L11") '" & LastRowTemp) '").CurrentRegion
Set rngOutput = Sheets("Sheet2").Cells(3, 1)
End With
strPTName = "PT_TEMPORAL"
With ActiveWorkbook.PivotCaches
With .Create(SourceType:=xlDatabase, SourceData:=rngData, Version:=xlPivotTableVersion10)
Set pvtTable = .CreatePivotTable(TableDestination:=rngOutput, TableName:=strPTName, _
DefaultVersion:=xlPivotTableVersion10)
End With
End With
and if you change the part in red to A1:L10, it works. as i have mentioned, it could be because of the text exceeding 255 characters. that's my guess.
Bookmarks