Share via

Error 1004 application-defined or object-defined error

Anonymous
2016-02-25T05:35:25+00:00

I am getting this error and I have no clue what to do. This is what I get when I run the debug:

Sub class_time()

'

' class_time Macro

' Macro recorded 1/19/2006 by DeVry

'

'

    With Selection

        .HorizontalAlignment = xlCenter

        .VerticalAlignment = xlTop

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .ShrinkToFit = False

        .MergeCells = False

    End With

    Selection.Merge

    With Selection.Interior

        .ColorIndex = 37

        .Pattern = xlSolid

    End With

The Selection.Merge is Highlighted.  Not sure what that means?

Microsoft 365 and Office | Excel | For home | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-02-26T12:59:35+00:00

As I mentioned, it's probably because you have a single cell selected. Try putting an apostrophe (') before the S in the Selection.Merge line. This will disable that line and it should now work. let me know what happens.

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-02-26T17:36:02+00:00

    I'm glad I was able to help. This problem had nothing to do with your Mac. It's a bug in the macro that you are using. The problem is with that program and/or it's author, not with your machine.

    In any case I'm pleased that it is now working and you can proceed.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-02-26T16:51:25+00:00

    Thank you so much! This apostrophe addition solved my problem. You have saved me from so much frustration! As much as I paid for this Mac, you'd think they'd make sure that you wouldn't come across such errors! I have no clue how you came up with this solution.  I even researched online and didn't find a thing. I wish I had computer smarts like you! Lol

    Thank you, I greatly appreciate your time spent on helping me!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-02-26T03:05:14+00:00

    This is a time management sheet that I am to fill out for school.  It has color code boxes to chose from to help highlight the activity.  When I click to color code the cell it then gives me the error.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2016-02-25T13:45:35+00:00

    What, exactly, are you expecting this macro to do?

    You will probably get the error if only one cell is selected when the macro runs.

    It is NEVER a good idea to merge cells. this should e avoided at all costs. So, I ask again, what is the macro supposed to be doing?

    Was this answer helpful?

    0 comments No comments