+ Reply to Thread
Results 1 to 12 of 12

I have broken my macro

  1. #1
    Registered User
    Join Date
    11-29-2017
    Location
    newport
    MS-Off Ver
    MS Office 365
    Posts
    21

    I have broken my macro

    Hi all, sorry to be a pain but I am trying to run a macro I have used a dozen times on a new workbook with different parameters and it keeps saying it needs debugging but having checked the code, the target and origin sheet names and ranges, I can not get it to work. a breakdown of what I am trying to do is

    1. take a range of fIgures from a sheet called MOJFR
    2. PASTE THEM INTO ROW b (OR THE NEXT AVAILABLE ROW) in another sheet called DEC
    3. No overwrite of data when I hit submit.

    The code I am using is;

    Please Login or Register  to view this content.
    Thanks all!!

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: I have broken my macro

    You want to copy from MOJFR to DEC?
    You need to change the sheet names accordingly
    So, both Strategy Log sheets become DEC and Strategy becomes MOJFR
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    11-29-2017
    Location
    newport
    MS-Off Ver
    MS Office 365
    Posts
    21

    Re: I have broken my macro

    Ahh Ive accidentally pasted an older version of the macro here instead of the one I am using. Here is the correct one;

    Please Login or Register  to view this content.
    Sorry!!
    Last edited by cdhampshire; 12-27-2017 at 10:07 AM.

  4. #4
    Registered User
    Join Date
    11-29-2017
    Location
    newport
    MS-Off Ver
    MS Office 365
    Posts
    21

    Re: I have broken my macro

    AS A BIT OF AN UPDATE

    When I run the debugger, it highlights the Sheets("MOJFR").Range("a38:v38").Copy row as yellow for some reason

    Thanks

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: I have broken my macro

    What is the error message? If it's a subscript out of range error, it means the sheet name is wrong- perhaps having a leading or trailing space.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Registered User
    Join Date
    11-29-2017
    Location
    newport
    MS-Off Ver
    MS Office 365
    Posts
    21

    Re: I have broken my macro

    I get a runtime error 40036

    application-defined or object-defined error

    I just double checked the sheet names and I have no spaces before or after im afraid

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: I have broken my macro

    Don't use "Sub Copy()". (I assume that the "[/" is a copy/paste problem.)
    "Copy" is, I think, a reserved name for vba. Something like "Copy_From_MOJFR_To_Dec" however is OK

    If you have many sheets and you want to delete possible leading or trailing spaces, try this
    Please Login or Register  to view this content.
    To copy and paste, you could try this instead.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-29-2017
    Location
    newport
    MS-Off Ver
    MS Office 365
    Posts
    21

    Re: I have broken my macro

    Thank you for this. Im afraid I am still having the same run-time error as before

    I have checked and it is a macro enabled workbook

  9. #9
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: I have broken my macro

    @cdhampshire - I've tried your code in a mock-up workbook, and it ran with no errors, so I can't see why you're getting the error.

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: I have broken my macro

    Do you have any activex controls on that sheet, such as commandbuttons?

  11. #11
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: I have broken my macro

    What do you have selected\chosen in the "Tools\References" option in VBA Editor (ALT+F11) ?

    Edit:
    Some reasons for the error "40036" - maybe not in this case, but in general:
    1. Corrupt download or incomplete installation of Microsoft Excel software
    2. Damage in the Microsoft Excel system registry due to recent change of software related to the Microsoft Excel file (installation or uninstallation)
    3. Virus or malware infection that has corrupted the Windows file or related Microsoft Excel files
    4. Another program maliciously or mistakenly deleted Microsoft Excel-related files
    Last edited by mjr veverka; 12-27-2017 at 01:19 PM.

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: I have broken my macro

    Starting from the left, where are the sheets you copy from and copy into? Like the 2nd sheet and the 5th sheet or whatever

+ 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] Complex macro broken, please send help
    By Ashe77 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2016, 09:48 AM
  2. Tally Macro: Broken Code
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2014, 04:43 PM
  3. [SOLVED] Basic Macro suddenly broken
    By Alaniz/MetroGroup in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2014, 10:40 AM
  4. [SOLVED] Dates are broken for use in a larger macro
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2012, 06:27 PM
  5. MACRO that created new tabs is broken
    By lissa843 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2010, 05:44 PM
  6. Macro broken with workbook name change
    By Annabelle in forum Excel General
    Replies: 2
    Last Post: 02-02-2006, 08:50 PM
  7. Broken macro in Excel 2003
    By kmbarz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2005, 08:06 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