Using a cell in excel to change a database

Hi All,

Newbie here, Hope I'm in the right section.

I like to be able to type the database name on to a cell in excel and then have my SQL pick up the change to amend the database. Do I need to write a macro or something.

Some of my SQL is below
SELECT CCDETHST.KEMPNO, KPERNO+0, CCDETHST.KPDNCO, CCDETHST.KRATE, CCDETHST.KDIFER, KRATE+KDIFER, CCDETHST.KHRTPD, CCDETHST.KAMTTP
FROM PBSC26DTA.CCDETHST CCDETHST
WHERE (CCDETHST.KPERNO>'201301' And

Summary:- I need to be able to replace PBSC26DTA with something I type into a cell in excel.

Many thanks and any help will be great

you need to write a macro. Try asking in Excel forums

Many thanks. I'll try searching for a good forum