+ Reply to Thread
Results 1 to 8 of 8

Error in part of macro - other identical parts work, and macro has been working for years

  1. #1
    Registered User
    Join Date
    03-18-2015
    Location
    Salt Lake City, UT
    MS-Off Ver
    Office Professional Plus 2010. V 14.0.7145.5000
    Posts
    4

    Error in part of macro - other identical parts work, and macro has been working for years

    The error I have received is:

    Run-time error 57121: application-defined or object-defined error

    The portion of the code is:

    Sheets("Submitted").Cells.AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
    :=Range("A1:A2"), CopyToRange:=Range("A65536").End(xlUp).Offset(1, 0), Unique:=False

    This macro pulls all of the rows with a certain piece of content off of each sheet and puts them in order on a new sheet.

    The macro itself runs through multiple sheets successfully, but when it hits "Submitted" it is giving the error message.

    Example of the part that runs successfully:

    Range("A65536").End(xlUp).Offset(1, 0).Select
    With Selection.Font
    .Name = "Arial"
    .Size = 14
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = xlAutomatic
    End With
    ActiveCell.FormulaR1C1 = "IN PRESS"
    Range("A65536").End(xlUp).Offset(1, 0).Select

    Sheets("In Press").Cells.AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
    :=Range("A1:A2"), CopyToRange:=Range("A65536").End(xlUp).Offset(1, 0), Unique:=False

    Range("A65536").End(xlUp).Offset(1, 0).Select
    With Selection.Font
    .Name = "Arial"
    .Size = 14
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = xlAutomatic
    End With
    ActiveCell.FormulaR1C1 = "SUBMITTED"
    Range("A65536").End(xlUp).Offset(1, 0).Select

    Sheets("Submitted").Cells.AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
    :=Range("A1:A2"), CopyToRange:=Range("A65536").End(xlUp).Offset(1, 0), Unique:=False



    I'm not a programmer, but someone helped me prepare this code years ago. Suddenly, today this has stopped working. Can you help me resolve the problem?

    Thank you very much in advance!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    What sheet is the criteria range on and what range do you want to filter on the 'Submitted' sheet?

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-18-2015
    Location
    Salt Lake City, UT
    MS-Off Ver
    Office Professional Plus 2010. V 14.0.7145.5000
    Posts
    4

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    I'm sorry I missed the instructions for the code tags. I'll try them here. I also apologize for not being entirely fluent in the language, but I hope I can answer your questions.

    I believe that the criteria range appears on every sheet. I have a sheet for each year on which I list the papers we publish. As of today, when I run the macro, I give a name that will appear in the first column and it pulls every row from every sheet in which that name appears.

    It does that successfully on sheets 2010, 2011, 2012, 2013, 2014, 2015, and "in press" but then hits sheet "submitted" and has the error.

    As far as I can tell, the code is identical for each sheet, so I can't find the problem. Here is a bit more of the code.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  5. #5
    Registered User
    Join Date
    03-18-2015
    Location
    Salt Lake City, UT
    MS-Off Ver
    Office Professional Plus 2010. V 14.0.7145.5000
    Posts
    4

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    I have attached a small version of the workbook. You'll see the Generator Tab, which is where I run the macro.

    I go to cell A3 and type Ctrl+Shift+L to run the macro (after I put the author's name in A2. I left one in for you).

    The code should be pulling all the rows with "Couldwell W" from all of the worksheets starting with "Published-2010" up to the worksheet "In prep"
    but it is only working through "In press"

    sample.xls

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    I can't find what is causing the problem but I was able to fix things by adding a new blank sheet, copying everything from 'Submitted' to it, deleting the original 'Submitted' sheet and renaming the new sheet as 'Submitted'.

    I also deleted the HTML object that was on 'Submitted' and all the pictures on 'Generator'.

  7. #7
    Registered User
    Join Date
    03-18-2015
    Location
    Salt Lake City, UT
    MS-Off Ver
    Office Professional Plus 2010. V 14.0.7145.5000
    Posts
    4

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    That worked for me to. I guess I should have tried that after I tried restarting the program, but I didn't think of it. I have to admit I'm glad I'm not the only one who couldn't figure out what the problem was.

    Where was the HTML object on "Submitted"? I don't know where to look to remove it from my original file. Also, the picture on "Generator" - I've noticed at least one a couple times up by cell A3 and deleted it, but it seems like it is always there the next time. Is there a way to find these things that are "hidden" on my spreadsheet?

    Thank you so very much for your help. I really appreciate the time you have spent helping me.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error in part of macro - other identical parts work, and macro has been working for ye

    If you goto Find & Select...Selection Pane... a pane will open up to the right of the sheet.

    That pane will list all the objects on the current sheet.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Only part of macro working
    By JamieBlanco in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 12:48 PM
  2. Replies: 1
    Last Post: 05-27-2014, 02:40 PM
  3. Replies: 0
    Last Post: 03-28-2013, 10:25 AM
  4. Work Out Top 100 parts by Value including a part count out of a list of 500
    By davidawright in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2012, 07:13 AM
  5. parts of macro aren't working
    By johnmerlino in forum Excel General
    Replies: 9
    Last Post: 12-12-2010, 03:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1