From: Jim on
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
From: ryguy7272 on
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...


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Jim" wrote:

> 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