Hi! Could someone look at this bit of code and tell me why it's not working? I tried using a defined range of data as the sourcedata for the pivot table, but it doesn't work.

Thanks!

    myLastRow = Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
    myLastColumn = Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column
    myLastCell = Cells(myLastRow, myLastColumn).Address
    myRange = "A1:" & myLastCell
    Application.ScreenUpdating = True
    
    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= &
    myRange.CreatePivotTable TableDestination:="", TableName:= _
        "PivotTable6", DefaultVersion:=xlPivotTableVersion10