Please help with ADO and VBScript!

J

jenhu

Hi expert,

I have to say that I have no experience in VBscript before, I am a dat
warehouse analyst and need to complete a report out of SQL Server.

I need to have a little excel vbscript with ADO recordset code t
change the first column, when it's starts with first letter 'D', then
will have to replace the cell to a district manager name.

First of all, I need to loop every row in column A only to find an
cell with a 'D' prefixed word, for example, D1009.
Then open a ADO connect to SQL Server and here is the SQL query:
SELECT 'D' + CAST(District_Num AS char(5)) AS DISTRICT, DISTRICT_MGR
FROM micros.Store_Table

As long as I find the cell to match DISTRICT, then it needs to b
replaced by DISTRICT_MGR

Can someone show me the VBScript to complete this task?

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top