Solved

Excel errors

Posted on 2014-09-10
4
298 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 500 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

691 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