locked
Excel 2007 VBA question RRS feed

  • Question

  • Hi,

    I'm trying to convert a range object into an address range:

    Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=Prange

    becomes:

    Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=PRange.Address(1, 1, xlD87487, External:=True))

    the issue is that xlD87487 is a variable but when I change xlD87487 to "xlD" & lastrow

    where lastrow is equal to 87487.

    I get a "Type Mismatch" error.

    This error occurs with xl & "D" & lastrow and xl & "D87487"

    Any clues would be appreciated.

    Thanks


    Tuesday, May 28, 2013 7:46 PM

All replies

  • I believe SourceData has to be a range object.  The Address property does not return a range object; it returns a string representing the address of the range expression (prrange)

    Ron

    Wednesday, May 29, 2013 12:05 AM