Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get round #REF during macro column deletes

Status
Not open for further replies.

Igwiz

Technical User
Jun 3, 2003
88
0
0
CA
Hi,

I have a SUMIF formula in a worksheet1 that references a worksheet2. I then run a macro that moves and deletes all sorts of columns but eventually leaves it in exactly the same format it started in albeit with different data. However, the SUMIF formula in ws1 now has #REF errors where it is referencing columns that were 'deleted'. How on earth can I get round this. Don't want to have to redefine the formula every time as there are more than one and that seems very inefficient!

Cheers,
Ig
 
I'd suggest you copy out the formula to a variable and replace it in the workbook once the column fiddling has been completed.

Not too hard to do using copy and paste, even in a macro.

HTH
David

[joinedupwriting]
"whaddaya mean, 'invalid tag'?!?"
[/joinedupwriting]

[lightsaber]
 
Skip,

Like I said, it only gets deleted because I copy over new data, consolidate and then put it back.

DPlank,

Ideally I want to avoid that because I have several that need replacing and it loops hundreds of times.

Will turning off automatic calculation when I'm doing the jiggery-pokery work?

Thanks.
 
Have rewritten the macro. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top