External Data from SQL Server

J

Jim

I have a worksheet that is importing data from SQL Server. MS Query is
configured to execute a stored procedure.

Sometimes when I refresh the query with new parameters I lose formatting and
formulas. It is as if Excel is inserting extra columns. the cells with the
formulas are moved to the right and lose their reference. In MS Query and
SMSS everything looks fine, but when the data is brought into Excel it goes
bonkers. I should point out that some of the data is fine, then others are
not.

Any suggestions on what to look for?

Thanks
 
R

ryguy7272

I've done this before and didn't encounter the problem you described. Are
you editing the query or re-importing the entire data set (which is what it
sounds like). I think this will cause everything to shift to the right.
Maybe you have to delete what's on the sheet, and re-import:

Cells.Select
Selection.ClearContents

'The formatting won't be deleted
'Do the MSQuery here...
 

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