+ Reply to Thread
Results 1 to 9 of 9

Macro Stopped Working

  1. #1
    Registered User
    Join Date
    12-28-2019
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    4

    Macro Stopped Working

    A friend created a complex macro that was running well and know gives a Compile error: Expected End With. I have changed it to end with but doesn't work and I am lost.
    Here is the part of the Macro. It is to copy and paste info in different tabs. Below is the code the error is right at the end, I also attached the spreadsheet ready to run the macro for you to have a look at the error.
    Thanks in advance.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Kpina; 12-28-2019 at 07:59 PM. Reason: Following Rule 2

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: Macro Stopped Working

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)


    Looking at the pattern in the code there appears to be 2 End With lines at each CutCopyMode set of code. One corresponding to the With Application the other to With Sheets("Data")
    Cheers
    Andy
    www.andypope.info

  3. #3
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Macro Stopped Working

    hi,

    Try using better indentation it will help you find little bugs like this

    There where 2 places you didn't have a "End With"

    Please Login or Register  to view this content.
    Please be as complete as possible in your asking so it may save use all the time to rework the solution because you didn't give all the requirements. If you have a layout in mind please work it out first so we can adapt our solution to it. Thanks.
    If you have been helped, maybe you could click the *

  4. #4
    Registered User
    Join Date
    12-28-2019
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    4

    Re: Macro Stopped Working

    Hi Joske920,

    Thanks for your reply. I attached the spreadsheet with the Macro as I can't find the issue or let's say my coding skills are below this code.
    Thanks

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Macro Stopped Working

    @Kpina,

    Please do not ignore the fact that one of our senior forum members has asked for you to comply with the forum rules. Please add code tags.
    HTH
    Regards, Jeff

  6. #6
    Registered User
    Join Date
    12-28-2019
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    4

    Re: Macro Stopped Working

    Hi jeffreybrown,

    Thanks for reminding me. I didn't ignore it, just didn't work when I applied the tags.
    Thanks again

  7. #7
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Macro Stopped Working

    Highlighted in red in the code below are the two End With lines you're missing.

    Please Login or Register  to view this content.
    Beth.

  8. #8
    Registered User
    Join Date
    12-28-2019
    Location
    Perth
    MS-Off Ver
    2016
    Posts
    4

    Re: Macro Stopped Working

    Hi BanginMyHeadOnMyDesk,
    It does work now.
    thanks a lot

  9. #9
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Macro Stopped Working

    Happy to help.

    Make sure your code tags work next time. You could have had the answer to this 23 hrs ago when I first saw the post.

    Beth.

+ 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. [SOLVED] My VBA macro has stopped working... Please Help!
    By ahalliwell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2018, 05:05 AM
  2. [SOLVED] Macro stopped working?
    By AmyV1 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-22-2017, 10:23 PM
  3. [SOLVED] Macro stopped working - please help
    By kellynicolebarrett in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-01-2014, 05:49 AM
  4. Macro stopped working
    By EverettRich in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-21-2013, 03:17 PM
  5. Macro Stopped Working
    By andybason in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2012, 01:20 PM
  6. Macro stopped working.
    By joleen in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-06-2011, 05:37 AM
  7. Excel 2007 : Macro stopped working
    By jaw0001 in forum Excel General
    Replies: 5
    Last Post: 10-13-2010, 07:59 AM

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