Type Mismatch error in Pivot creation

Hello All,

I am facing Type mismatch error while creating pivot table in excel i have used macro and also uipath VBA code for pivot creation.
But not sure if my excel is having issues or code issue.
Can any one check below code and excel.Sequence3.xaml (7.7 KB) Book3.xlsx (48.0 KB)

image

is this error ? are you getting ?

ERROR1:

your VB code is reading Blank columns …please change to following

rng=ws.Range(“A1:J1”&sheetRange)‘Selects the given range of sheet 1’

ERROR2:

THERE IS NO COLUMN CALLED “primary territory”)…you should deleteBook3.xlsx (53.3 KB) following code form the activity

oPivotField=CType(oPivotTable.PivotFields(“Primary Territory”),Microsoft.Office.Interop.Excel.PivotField)‘Specfiy the coulmn name’
oPivotField.Orientation=Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField

Hello,
No i am getting type mismatch error, this error is because i have deleted few data and uploaded as it is confidential.

Thanks & Regards,

Padmini

Hi

type mismatch errors comes …whenever …

you are reading range that includes Blank columns or

you code is not selecting range with data

Hello @allurai_india,

Can you please let me know how to select range if we have a blank data existing and if we need to consider it?

Thanks,
Padmini