PC Review


Reply
Thread Tools Rate Thread

Copy Paste failed in excel file migrated from Excel 2003 to Excel

 
 
Handong Chen
Guest
Posts: n/a
 
      4th Mar 2010
We have two excel files (~15 sheets each, 20-60 rows and ~30 columns each
sheet) that has been working well in 2003. Recently, we upgraded our office
to 2007. And saved these files to xlsm format. We open these two files in two
different Excel instances. When we tried to copy cells from one workbook to
the other, the destination cells become empty. If we use CTRL+Z to undo, a
msgbox pops out that says "Too many cells formats". BTW, the contents to be
copied has merged cells.

We tried to us VBA to copy all the formulas and formats of these two files
to two new files (No format was copied). The same problem happens when we try
to copy between these two files.

Please help.

Thanks.
 
Reply With Quote
 
 
 
 
Handong Chen
Guest
Posts: n/a
 
      4th Mar 2010
I solved this issue myself. After the conversion from Excel 2003 to Excel
2007, there are 58777 styles in the workbook! The following code can delete
extra styles generated during the conversion from Excel 2003 to Excel 2007.
What this code does is to delete those styles whose names end with a digit.



Sub ClearStyles()
Dim i&, Cell As Range, RangeOfStyles As Range
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = False
'Add a temporary sheet
Set ws = Sheets.Add(before:=Sheets(1))
'List all the styles

For i = 1 To ActiveWorkbook.Styles.Count
ws.Cells(i, 1) = ActiveWorkbook.Styles(i).Name
Next

Cells(1, 3).Formula = "=ISNUMBER(INT(RIGHT(A1,1)))"
RowCount = Cells(1, 1).End(xlDown).Row

Cells(1, 3).AutoFill Destination:=Range(Cells(1, 3), Cells(RowCount, 3))

Set RangeOfStyles = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
Application.CalculateFull

For Each Cell In RangeOfStyles
'If Not Cell.Text Like "Normal" Then

If Cell.Offset(0, 2) Then
On Error Resume Next
ActiveWorkbook.Styles(Cell.Text).Delete
'ActiveWorkbook.Styles(Cell.NumberFormat).Delete
End If
Next Cell
'delete the temp sheet
Application.DisplayAlerts = False
ActiveSheet.Delete

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True

End Sub






"Handong Chen" wrote:

> We have two excel files (~15 sheets each, 20-60 rows and ~30 columns each
> sheet) that has been working well in 2003. Recently, we upgraded our office
> to 2007. And saved these files to xlsm format. We open these two files in two
> different Excel instances. When we tried to copy cells from one workbook to
> the other, the destination cells become empty. If we use CTRL+Z to undo, a
> msgbox pops out that says "Too many cells formats". BTW, the contents to be
> copied has merged cells.
>
> We tried to us VBA to copy all the formulas and formats of these two files
> to two new files (No format was copied). The same problem happens when we try
> to copy between these two files.
>
> Please help.
>
> Thanks.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy 2007 excel file formula results into a 2003 Excel file Nuria Alba de Luz Microsoft Excel Misc 2 10th Jul 2009 01:48 PM
HELP - Excel 2003 cut, copy, paste and paste special problems Carrie Microsoft Excel Crashes 2 9th Dec 2008 06:36 PM
Excel 2000 copy, edit, paste spacial, value. How Excel 2007 ?? Boaz Amir Microsoft Excel Misc 1 30th Apr 2008 10:15 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Microsoft Excel Programming 1 17th Oct 2005 08:56 AM
Lotus Notes Q: Copy'n paste from Excel AND place Excel attachment =?Utf-8?B?VGV0c3V5YSBPZ3VtYQ==?= Microsoft Excel Programming 1 21st Jun 2004 06:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:37 AM.