View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Refsdal Jan Refsdal is offline
external usenet poster
 
Posts: 1
Default Run-time error '5':Invalid Procedure call or argument

I'm attempting to write VBA code for a pivot table range selection, this
expression works when SourceData is set to a fixed range, but when set to
the varaible range selection as noted below I receive the subject error
message

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
Sheets("Sheet1").Range(Cells(1, 1), Cells(i,5))).CreatePivotTable _
TableDestination:="", _
TableName:="PivotTable9"

Thanks