Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Rescuing Sheets in Corrupt Workbook

I have a workbook which I suspect is corrupt, or at least becoming so: I'm
getting truly funky characters, saved changes don't "stick" when I close out
and open it back up, etc.

I'd like to just move the active sheets out of the current workbook and put
them in a new workbook to see if that helps. My plan was to move them and
then use "Replace" to delete the file path to the original workbook which
Excel inserts into the formulas. Unfortunately, I can't even get to this
point because the appended formulas are too long and get cut off.

Is there a way to tell Excel NOT to update the formulas to include paths to
external workbooks? I need the formulas to be functional in the new workbook,
so I don't want to convert to values only.

Thanks for any help anyone can offer!


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Rescuing Sheets in Corrupt Workbook

Michael,

Try this. For each sheet in your workbook, run the first macro. Then copy the cells and paste as
values into a blank sheet in your new workbook (one for each existing sheet). Then run the second
macro on all sheets in your new workbook. These macros will work on regular formulas, but not
multi-cell or single-cell array formulas.

HTH,
Bernie
MS Excel MVP

Sub FormulaToText()
Dim myCell As Range
Dim myCalc As Variant

With Application
.ScreenUpdating = False
myCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
End With

On Error Resume Next

For Each myCell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormu las)
myCell.Formula = "'" & myCell.Formula
Next myCell

With Application
.ScreenUpdating = True
.Calculation = myCalc
.EnableEvents = True
End With
End Sub


Sub TextToFormula()
Dim myCell As Range
Dim myCalc As Variant

With Application
.ScreenUpdating = False
myCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
End With

On Error Resume Next

For Each myCell In ActiveSheet.UsedRange
myCell.Formula = myCell.Text
Next myCell

With Application
.ScreenUpdating = True
.Calculation = myCalc
.EnableEvents = True
End With
End Sub

"Michael Link" wrote in message
...
I have a workbook which I suspect is corrupt, or at least becoming so: I'm
getting truly funky characters, saved changes don't "stick" when I close out
and open it back up, etc.

I'd like to just move the active sheets out of the current workbook and put
them in a new workbook to see if that helps. My plan was to move them and
then use "Replace" to delete the file path to the original workbook which
Excel inserts into the formulas. Unfortunately, I can't even get to this
point because the appended formulas are too long and get cut off.

Is there a way to tell Excel NOT to update the formulas to include paths to
external workbooks? I need the formulas to be functional in the new workbook,
so I don't want to convert to values only.

Thanks for any help anyone can offer!




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Rescuing Sheets in Corrupt Workbook

Actually, I think this would work, but just because it was slightly simpler,
I tried Dave P's solution below first, and that did the job. I think I'll
keep this macro on file, though, as a backup. Thanks for the solution and for
the super fast response!

"Bernie Deitrick" wrote:

Michael,

Try this. For each sheet in your workbook, run the first macro. Then copy the cells and paste as
values into a blank sheet in your new workbook (one for each existing sheet). Then run the second
macro on all sheets in your new workbook. These macros will work on regular formulas, but not
multi-cell or single-cell array formulas.

HTH,
Bernie
MS Excel MVP

Sub FormulaToText()
Dim myCell As Range
Dim myCalc As Variant

With Application
.ScreenUpdating = False
myCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
End With

On Error Resume Next

For Each myCell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormu las)
myCell.Formula = "'" & myCell.Formula
Next myCell

With Application
.ScreenUpdating = True
.Calculation = myCalc
.EnableEvents = True
End With
End Sub


Sub TextToFormula()
Dim myCell As Range
Dim myCalc As Variant

With Application
.ScreenUpdating = False
myCalc = .Calculation
.Calculation = xlCalculationManual
.EnableEvents = False
End With

On Error Resume Next

For Each myCell In ActiveSheet.UsedRange
myCell.Formula = myCell.Text
Next myCell

With Application
.ScreenUpdating = True
.Calculation = myCalc
.EnableEvents = True
End With
End Sub

"Michael Link" wrote in message
...
I have a workbook which I suspect is corrupt, or at least becoming so: I'm
getting truly funky characters, saved changes don't "stick" when I close out
and open it back up, etc.

I'd like to just move the active sheets out of the current workbook and put
them in a new workbook to see if that helps. My plan was to move them and
then use "Replace" to delete the file path to the original workbook which
Excel inserts into the formulas. Unfortunately, I can't even get to this
point because the appended formulas are too long and get cut off.

Is there a way to tell Excel NOT to update the formulas to include paths to
external workbooks? I need the formulas to be functional in the new workbook,
so I don't want to convert to values only.

Thanks for any help anyone can offer!





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Rescuing Sheets in Corrupt Workbook

Maybe you could change your formulas to strings.

Select all the cells (before you've copied the sheet)
edit|replace
what: = (equal sign)
with: $$$$$=
replace all

then move/copy the sheet

And when you're ready, just replace the $$$$$= with =.

Don't forget to do the original worksheet, too (if you copied).

Michael Link wrote:

I have a workbook which I suspect is corrupt, or at least becoming so: I'm
getting truly funky characters, saved changes don't "stick" when I close out
and open it back up, etc.

I'd like to just move the active sheets out of the current workbook and put
them in a new workbook to see if that helps. My plan was to move them and
then use "Replace" to delete the file path to the original workbook which
Excel inserts into the formulas. Unfortunately, I can't even get to this
point because the appended formulas are too long and get cut off.

Is there a way to tell Excel NOT to update the formulas to include paths to
external workbooks? I need the formulas to be functional in the new workbook,
so I don't want to convert to values only.

Thanks for any help anyone can offer!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Rescuing Sheets in Corrupt Workbook

Your idea did the job, Dave: Thanks! I wouldn't have thought of that at all!
Now all I have to do is play around with the spreadsheet to see if the new
workbook addresses the corruption issue. If not, perhaps I'll just call it a
day and get a margarita!

"Dave Peterson" wrote:

Maybe you could change your formulas to strings.

Select all the cells (before you've copied the sheet)
edit|replace
what: = (equal sign)
with: $$$$$=
replace all

then move/copy the sheet

And when you're ready, just replace the $$$$$= with =.

Don't forget to do the original worksheet, too (if you copied).

Michael Link wrote:

I have a workbook which I suspect is corrupt, or at least becoming so: I'm
getting truly funky characters, saved changes don't "stick" when I close out
and open it back up, etc.

I'd like to just move the active sheets out of the current workbook and put
them in a new workbook to see if that helps. My plan was to move them and
then use "Replace" to delete the file path to the original workbook which
Excel inserts into the formulas. Unfortunately, I can't even get to this
point because the appended formulas are too long and get cut off.

Is there a way to tell Excel NOT to update the formulas to include paths to
external workbooks? I need the formulas to be functional in the new workbook,
so I don't want to convert to values only.

Thanks for any help anyone can offer!


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting a single sheet from a volume of sheets in a workbook No News Excel Worksheet Functions 12 July 1st 06 05:29 AM
Copy formatted in several sheets of a workbook Emece Excel Worksheet Functions 1 September 28th 05 10:10 PM
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard Excel Discussion (Misc queries) 2 August 4th 05 04:30 PM
Numbering sheets in workbook Red Excel Worksheet Functions 3 March 2nd 05 08:10 PM
Automatically copy selective sheets from one workbook to another Ann Excel Discussion (Misc queries) 0 March 1st 05 07:09 PM


All times are GMT +1. The time now is 11:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"