ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SQL stored procedure using values from cells into Pivot Table (https://www.excelbanter.com/excel-programming/354814-sql-stored-procedure-using-values-cells-into-pivot-table.html)

kworth

SQL stored procedure using values from cells into Pivot Table
 
I'm calling a stored procedure on our SQL server to generate a pivot
table. I want to be able to set one worksheet cell to a "start date"
value and one to an "end date" value, then have the stored procedure
called with these cell values as arguments @start and @end. I think I
am almost there but I don't know how to get the value from the cell
into the Pivot Table properties. If I open the Script Editor, I see the
section

<x:PTSource
...snip..
<x:QuerySource
...snip..
<x:CommandTextexec sp_sales '2/1/2006',
'2/28/2006';</x:CommandText
...snip...
</x:QuerySource
</x:PTSource

If I change the values in the CommandText line, it make the Pivot Table
use those arguments the next time I refresh it. This is exactly what I
want, but I want to have the values of, say, cells A1 and A2 instead of
'2/1/2006' and '2/28/2006'.

Any ideas? I'm a super-noobie at programming in Excel, I'm sure this
must have a simple answer.

Thanks!



All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com