Excel errors

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?
akdreamingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Glenn RayExcel VBA DeveloperCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ThomasMcA2Commented:
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
akdreamingAuthor Commented:
thank you.
0
Glenn RayExcel VBA DeveloperCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.