+ Reply to Thread
Results 1 to 9 of 9

Getting Error 1004, can't get it to stop

  1. #1
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    70

    Getting Error 1004, can't get it to stop

    Please Login or Register  to view this content.
    I want to be able have it only warn me there is already a sheet with that name but not copy the original with the (#). I have about 24 of these now. Temp (#).
    Last edited by LightHeart7; 02-03-2015 at 01:07 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Getting Error 1004, can't get it to stop

    You have commented out a line... without that line your macro does not check whether that sheet already exits. So your macro would not detect the condition of duplicate names. If you re-enable the "set wsNew..." line then it should skip over the copy and rename part of the program.
    Also if you want a message then just before
    Please Login or Register  to view this content.
    add a line:
    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    70

    Re: Getting Error 1004, can't get it to stop

    I stopped that line because every time it went to that line it kept giving me Subscript out of range. When i took it out it worked until i got to where it was getting same name tabs

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Getting Error 1004, can't get it to stop

    Hi there,

    Ensure this part...

    Please Login or Register  to view this content.
    ...of this line of code:

    Please Login or Register  to view this content.
    is not blank or can be a valid sheet name i.e. not greater than 31 characters for example.

    You do need some code to check if the proposed tab name already exists in the workbook or not.

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    70

    Re: Getting Error 1004, can't get it to stop

    It is not blank, really it should be one_two as the page but i'm still getting it as an error. Is there a code that will just make it skip that error? so the warning stops coming up and either skips it or continues on?

  6. #6
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    70

    Re: Getting Error 1004, can't get it to stop

    I've tried un-commenting
    Please Login or Register  to view this content.
    but i'm still just getting out of range even when i change sheets to worksheets.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Getting Error 1004, can't get it to stop

    I think you have your VB editor set to break on all errors, which is the only reason your On Error Resume Next statement would be ignored.
    Remember what the dormouse said
    Feed your head

  8. #8
    Registered User
    Join Date
    09-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    70

    Re: Getting Error 1004, can't get it to stop

    Yes, that is exactly it. It was on break on all errors. is it normally supposed to be on Class Module or unhanded errors? Its working like a charm now. Thank you so much. Such a easy thing to miss!

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Getting Error 1004, can't get it to stop

    I always have it set to break in class modules.

+ 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. PasteSpecial causing RunTime error 1004 & autofill doesn't stop at last line
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2014, 09:18 AM
  2. Macros stop to work when work sheet is protected. Run time error 1004
    By sellim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2012, 01:14 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. "File listings stop unexpectedly - error 1004".
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2011, 05:45 AM

Tags for this Thread

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