Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Passing data from a cell in an Excel spreadsheet

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-11 : 07:59:52
Andrew writes "If I have an excel spreadsheet with a sheet named sheet1 and I am using the get external data feature to query the database using a stored procedure which I have to pass a date and it will grab all the data I need from that date to present, (whew) and I want to enter the date (F1) in sheet1 and have that passed into the date area of the SQL statement part of microsoft query in excel, can I do it?

Basically, I am using mirosoft query (SQL part) to run a stored procedure that I have to pass a date. I want to pass the date to it from F1 in sheet1 of my excel document. ANY HELP you could offer me in this endeavor would be greatly appreciated."

SMerrill
Posting Yak Master

206 Posts

Posted - 2005-09-09 : 14:20:08
You would have to write Excel VBA code to accomplish this.
Step 1: Begin recording a new macro.
Step 2: While recording, run your Get External Data procedure.
Step 3: Stop recording.
Step 4: Go into your recorded macro, find the part when you typed in the date parameter, and replace it with a reference to the content of cell F1.
Step 5: Run your new macro and see if it works.

~ Shaun Merrill
Seattle, WA
Go to Top of Page
   

- Advertisement -