I'm using VB.NET to read database and write data into Excel document. Now I need to create a pivot table into same Excel document, but I have no idea how to do this and couldn't find any useful samples. I tried to record a macro when creating pivot table manually, but I couldn't get that code to work in VB.NET. What I need to do is to read certain range of cells from a worksheet and write a pivot table into another worksheet. Does anyone have a sample how to do this or a place where to obtain more info?