?
Solved

Excel errors

Posted on 2014-09-10
4
Medium Priority
?
307 Views
Last Modified: 2014-10-09
Have an Excel file we are working with.  It is about 10Mb, has probably 15-20 tabs in it, and many formulas throughout.  We are working with Office 2010 version of Excel.  When user tries to paste, she is getting an error of "Microsoft cannot paste the data".  She is copying from one Excel file to another Excel file.  Cells are identical layout.

When she tries to change the colors of three separate cells, all in the same row, and all right next to each other, she gets "Too Many Different Cell Formats".  

Any help on this at all?
0
Comment
Question by:akdreaming
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 2000 total points
ID: 40315418
I deal with this on a regular basis.  The file is probably the result of several other Excel files having been cut and pasted into this one, with their source formatting/styles/range names all being globbed into this.  You finally get to a point where there can be thousands of useless styles and bad names in a document.  Eventually, one ends up with the kind of issues you're having right now.

To clean these files, I usually end up editing the underlying XML data (convert file to a zip file, then use an advanced text editor to remove the extraneous styles and range names).  However, here are a couple of macros that might work:
Sub DelStyle()
    ' macro from Dave Peterson, Excel MVP
    'On Error Resume Next
    Dim myStyle As Style
    For Each myStyle In ActiveWorkbook.Styles
        If myStyle.BuiltIn Then
            'do nothing
        Else
            myStyle.Delete
        End If
    Next myStyle
    MsgBox "Done!", vbOKOnly, "Deleted Styles"
End Sub

Open in new window


Sub Remove_Bad_Names()
    'Removes range names with invalid references (non-existent)
    Dim testRng As Range
    Dim myName As Name
    For Each myName In ActiveWorkbook.Names
        Set testRng = Nothing
        On Error Resume Next
        Set testRng = myName.RefersToRange
        On Error GoTo 0
        If testRng Is Nothing Then
            'doesn't refer to a real range
            'MsgBox myName.Name
            myName.Delete
        End If
    Next myName
End Sub

Open in new window


If the data isn't proprietary, you could attach it here and I'd be glad to clean up your file extensively.

Regards,
-Glenn
0
 
LVL 14

Expert Comment

by:ThomasMcA2
ID: 40316171
An error while copying or pasting could happen because of a filter. When a filter is enabled, Excel must "select" multiple chunks of data. For example, rows 2-5, 10-12, 20-30 all match the filter, so those data chunks must be selected. When you have thousands of rows, those chunks can create memory issues when copying and/or pasting.

If the user has filters enabled on the data being copied, remove the filter, then sort on the filtered column(s), then re-enable the filter, then try the copy and paste again.
0
 

Author Closing Comment

by:akdreaming
ID: 40371823
thank you.
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40371839
I'd forgotten about this thread.  

Since then I've started using the XLStylesTool and have to say I'm very impressed with how fast and thorough it runs.  Microsoft even mentions it in one of their KB articles (KB213904).

-Glenn
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question